From patchwork Sun Feb 2 03:16:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zoran Markovic X-Patchwork-Id: 24014 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qa0-f69.google.com (mail-qa0-f69.google.com [209.85.216.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1EEBA20341 for ; Sun, 2 Feb 2014 03:18:19 +0000 (UTC) Received: by mail-qa0-f69.google.com with SMTP id w8sf13768386qac.8 for ; Sat, 01 Feb 2014 19:18:18 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=bC+T5Ldn9brvr/sdgVmOo7sg417yASmKzcnqzx9ng2g=; b=XpYOFkMgfDtpBSIRfKhptwo6Tk5ddqP2+RbuCu7UBKQ//f/w5RhBezseN75tMZ+390 7SF2tR+VA068jnc+qJ8whnvT5bv1QIXSBBLpNCx/1lqSBCuBiKJA/T52Mmy3QXzKyEME D8M3LCX0IJyl7vU5pBZlcRiTKfhMVatAeKqHqLIdshVquPDAYhgf/0gJnkE6Nl/8LzZb n1ws3C3QgsgZG1uwL6WUsLbNnOxvFgW3emOyvi9WGZ0vf7QDwyF4WX9MBoZ7SIvP9Dr7 uNop1uJURqE0AdzqMO2AX84tsa5ppius9LkC0k4RWJlXXLoov9RCB4vXjvL8IAUQqAuL w+ug== X-Gm-Message-State: ALoCoQllzfZi7Lx6mrxn88hbKGz/0RjKZeCp9y+gDyH8jCGEQSdZ7Ht8i/cLtptUl9RrSa+imphK X-Received: by 10.58.85.3 with SMTP id d3mr4481695vez.40.1391311098790; Sat, 01 Feb 2014 19:18:18 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.43.201 with SMTP id e67ls1411133qga.32.gmail; Sat, 01 Feb 2014 19:18:18 -0800 (PST) X-Received: by 10.58.132.203 with SMTP id ow11mr23264151veb.1.1391311098736; Sat, 01 Feb 2014 19:18:18 -0800 (PST) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id si7si5451666vdc.76.2014.02.01.19.18.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 01 Feb 2014 19:18:18 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id jx11so4077184veb.38 for ; Sat, 01 Feb 2014 19:18:18 -0800 (PST) X-Received: by 10.52.170.241 with SMTP id ap17mr19154528vdc.13.1391311098643; Sat, 01 Feb 2014 19:18:18 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp65272vcz; Sat, 1 Feb 2014 19:18:18 -0800 (PST) X-Received: by 10.68.237.133 with SMTP id vc5mr29610029pbc.92.1391311097573; Sat, 01 Feb 2014 19:18:17 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i8si15823806pav.190.2014.02.01.19.18.16; Sat, 01 Feb 2014 19:18:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751013AbaBBDRi (ORCPT + 3 others); Sat, 1 Feb 2014 22:17:38 -0500 Received: from mail-pd0-f178.google.com ([209.85.192.178]:59012 "EHLO mail-pd0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750884AbaBBDRh (ORCPT ); Sat, 1 Feb 2014 22:17:37 -0500 Received: by mail-pd0-f178.google.com with SMTP id y13so5661898pdi.23 for ; Sat, 01 Feb 2014 19:17:36 -0800 (PST) X-Received: by 10.66.240.4 with SMTP id vw4mr29411077pac.26.1391311056741; Sat, 01 Feb 2014 19:17:36 -0800 (PST) Received: from localhost.localdomain ([154.5.129.240]) by mx.google.com with ESMTPSA id hb10sm42272211pbd.1.2014.02.01.19.17.34 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 01 Feb 2014 19:17:36 -0800 (PST) From: Zoran Markovic To: linux-kernel@vger.kernel.org Cc: linux-usb@vger.kernel.org, Shaibal Dutta , Greg Kroah-Hartman , Alan Stern , Sarah Sharp , Xenia Ragiadakou , Julius Werner , Krzysztof Mazur , Matthias Beyer , Dan Williams , Mathias Nyman , Thomas Pugliese , Zoran Markovic Subject: [RFC PATCHv2] usb: move hub init and LED blink work to power efficient workqueue Date: Sat, 1 Feb 2014 19:16:46 -0800 Message-Id: <1391311006-4138-1-git-send-email-zoran.markovic@linaro.org> X-Mailer: git-send-email 1.7.9.5 Sender: linux-usb-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: zoran.markovic@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Shaibal Dutta Allow the scheduler to select the best CPU to handle hub initalization and LED blinking work. This extends idle residency times on idle CPUs and conserves power. This functionality is enabled when CONFIG_WQ_POWER_EFFICIENT is selected. Cc: Greg Kroah-Hartman Cc: Alan Stern Cc: Sarah Sharp Cc: Xenia Ragiadakou Cc: Julius Werner Cc: Krzysztof Mazur Cc: Matthias Beyer Cc: Dan Williams Cc: Mathias Nyman Cc: Thomas Pugliese Signed-off-by: Shaibal Dutta [zoran.markovic@linaro.org: Rebased to latest kernel. Added commit message. Changed reference from system to power efficient workqueue for LEDs in check_highspeed() and hub_port_connect_change().] Signed-off-by: Zoran Markovic --- drivers/usb/core/hub.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index babba88..e11a7e9 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -504,7 +504,8 @@ static void led_work (struct work_struct *work) changed++; } if (changed) - schedule_delayed_work(&hub->leds, LED_CYCLE_PERIOD); + queue_delayed_work(system_power_efficient_wq, + &hub->leds, LED_CYCLE_PERIOD); } /* use a short timeout for hub/port status fetches */ @@ -1046,7 +1047,8 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) if (type == HUB_INIT) { delay = hub_power_on(hub, false); PREPARE_DELAYED_WORK(&hub->init_work, hub_init_func2); - schedule_delayed_work(&hub->init_work, + queue_delayed_work(system_power_efficient_wq, + &hub->init_work, msecs_to_jiffies(delay)); /* Suppress autosuspend until init is done */ @@ -1200,7 +1202,8 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) /* Don't do a long sleep inside a workqueue routine */ if (type == HUB_INIT2) { PREPARE_DELAYED_WORK(&hub->init_work, hub_init_func3); - schedule_delayed_work(&hub->init_work, + queue_delayed_work(system_power_efficient_wq, + &hub->init_work, msecs_to_jiffies(delay)); return; /* Continues at init3: below */ } else { @@ -1214,7 +1217,8 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type) if (status < 0) dev_err(hub->intfdev, "activate --> %d\n", status); if (hub->has_indicators && blinkenlights) - schedule_delayed_work(&hub->leds, LED_CYCLE_PERIOD); + queue_delayed_work(system_power_efficient_wq, + &hub->leds, LED_CYCLE_PERIOD); /* Scan all ports that need attention */ kick_khubd(hub); @@ -4316,7 +4320,8 @@ check_highspeed (struct usb_hub *hub, struct usb_device *udev, int port1) /* hub LEDs are probably harder to miss than syslog */ if (hub->has_indicators) { hub->indicator[port1-1] = INDICATOR_GREEN_BLINK; - schedule_delayed_work (&hub->leds, 0); + queue_delayed_work(system_power_efficient_wq, + &hub->leds, 0); } } kfree(qual); @@ -4545,7 +4550,9 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1, if (hub->has_indicators) { hub->indicator[port1-1] = INDICATOR_AMBER_BLINK; - schedule_delayed_work (&hub->leds, 0); + queue_delayed_work( + system_power_efficient_wq, + &hub->leds, 0); } status = -ENOTCONN; /* Don't retry */ goto loop_disable;