Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp7072963imm; Tue, 24 Jul 2018 08:01:01 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdYYoOttP3uRyNAaTRDnnnoYqXVy0fIHKVUthISEa8IGNByNEW+C3utvboASh+TJALkCuso X-Received: by 2002:a17:902:6946:: with SMTP id k6-v6mr17563696plt.268.1532444461352; Tue, 24 Jul 2018 08:01:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532444461; cv=none; d=google.com; s=arc-20160816; b=dNHtzHuxxuhuoWFQ1sh82aBKvCzVmjl2JEHJtglSBaRfxTs3zXqexjvmHeS21LaYU9 k6Jj1zWI94Tm+MjHuWwxKqAIA/thA6U2g+y5gZPeQ6a80BOBtokMv1VmgOdf58S8qxFs z/zdK05+xRUJrUIdK34HEqWUd8dDU/U2cKh5wvphRXvA2E/D1IufRUjlXTxh5A9i6fsg L+APWzyAah1Ln9mcMLjBpLnU8nEhtnQC1WbU1bF+3KgV+AF9HOops2LIQrsuizlH+2Jv q6W8a5ukjTvwAIT9LReZXlqL8uYufVomN6XEvL247L5WzDhiUGiHlIGPB8+DHStFA9wm Camg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=O+Qs4WepkTxb9RgHchfDyzW7UdT5Qp9JdDh3nUQRFHU=; b=KeE6R30Co/1d4HQIrUh53Kl3D1OLJU3ly/SO+uVCIvwmjUJUTmqTYLYpmaI19LNtCi Dhfzz2vXGu81WmVJ/z760/WnU4ZvKRByCdQ3qcuEgs1Q2bPNkWavIqDFG7MmDIFKDn+0 FezNNRnOo8c9ScgLLKeiFwUq5P+RreiIIY4sNlTCZAzWHEq7BIZwnUO0ueSGVTVFrYYC 8PPy2Zp1TxBXxkaxSmVRRrxp1iNeCYdMM/8NDI2WbfFRFYdaTwnO2ZC+IV/AbSrQCsga aaUO/fXUwzG2jEhzu3lQWthN/eRQ4MWPaOeKF0FXClYaekZFwU2B2R3G91riQurnQh0b nIAg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id be5-v6si11428063plb.67.2018.07.24.08.00.46; Tue, 24 Jul 2018 08:01:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388710AbeGXQGm (ORCPT + 99 others); Tue, 24 Jul 2018 12:06:42 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:44572 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S2388614AbeGXQGm (ORCPT ); Tue, 24 Jul 2018 12:06:42 -0400 Received: (qmail 1358 invoked by uid 2102); 24 Jul 2018 10:59:49 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 24 Jul 2018 10:59:49 -0400 Date: Tue, 24 Jul 2018 10:59:49 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Paul Menzel cc: linux-usb@vger.kernel.org, Subject: Re: `ohci_rh_resume()` called during `usb_dev_suspend()` In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 24 Jul 2018, Paul Menzel wrote: > Dear Alan, > > > Thank you for your quick response. > > On 07/24/18 16:21, Alan Stern wrote: > > On Tue, 24 Jul 2018, Paul Menzel wrote: > > >> Profiling the suspend to and resume/wake-up from ACPI S3 with > >> `sleepgraph.py` on an ASRock E350M1, I noticed that resume methods are > >> called during suspend. > >> > >> Here is an excerpt from the callgraph. > >> > >>> 600.376906 | 0) kworker-81 | | /* device_pm_callback_start: usb usb5, parent: 0000:00:14.5, type [suspend] */ > >>> 600.376909 | 0) kworker-81 | | usb_dev_suspend() { > >>> 600.376911 | 0) kworker-81 | | usb_suspend() { > >>> 600.376913 | 0) kworker-81 | | __pm_runtime_resume() { > >>> 600.376915 | 0) kworker-81 | | _cond_resched() { > >>> 600.376917 | 0) kworker-81 | 0.565 us | rcu_all_qs(); > >>> 600.376921 | 0) kworker-81 | 4.034 us | } /* _cond_resched */ > >>> 600.376922 | 0) kworker-81 | 0.505 us | _raw_spin_lock_irqsave(); > >>> 600.376926 | 0) kworker-81 | | rpm_resume() { > >>> 600.376928 | 0) kworker-81 | 0.573 us | _raw_spin_lock(); > >>> 600.376934 | 0) kworker-81 | 0.706 us | rpm_resume(); > >>> 600.376937 | 0) kworker-81 | 0.556 us | _raw_spin_lock(); > >>> 600.376942 | 0) kworker-81 | 0.721 us | __rpm_get_callback(); > >>> 600.376946 | 0) kworker-81 | 0.564 us | dev_pm_disable_wake_irq_check(); > >>> 600.376949 | 0) kworker-81 | | rpm_callback() { > >>> 600.376952 | 0) kworker-81 | | __rpm_callback() { > >>> 600.376954 | 0) kworker-81 | | usb_runtime_resume() { > >>> 600.376956 | 0) kworker-81 | | usb_resume_both() { > >>> 600.376959 | 0) kworker-81 | | generic_resume() { > >>> 600.376960 | 0) kworker-81 | | hcd_bus_resume() { > >>> 600.376963 | 0) kworker-81 | | ohci_bus_resume [ohci_hcd]() { > >>> 600.376964 | 0) kworker-81 | 0.588 us | _raw_spin_lock_irq(); > >>> 600.376968 | 0) kworker-81 | | ohci_rh_resume [ohci_hcd]() { > >>> 600.377043 | 0) kworker-81 | | msleep() { > >> > >> Please find the full callgraph and the HTML output attached. > >> > >> Is that expected? > > > > I can't tell exactly what's happening from your callgraph and HTML, but > > yes, in general it is expected. > > > > The reason is because some devices have different wakeup settings for > > runtime suspend and system suspend: A device that is enabled for wakeup > > signalling during runtime suspend often is not enabled for wakeup > > during system suspend. > > > > As a result, the device's wakeup setting has to be changed when the > > system goes to sleep, and to do that, we have to wake the device up > > temporarily if it is already in runtime suspend. > > Understood. Thank you for the explanation. > > Sorry for being ignorant, but I have two more questions. > > 1. Should this also happen, if no USB device is connected to a hub? Yes, it can happen, because the root hub (which is built into the USB controller hardware on the computer) may have different wakeup settings for runtime suspend and system suspend. > 2. If somebody point me to the code, how the callback(?) > `pm_runtime_resume()` is hooked up in `usb_suspend()` that’d help > me to better understand, what is going on. usb_suspend() calls choose_wakeup(), and under certain conditions, choose_wakeup() calls pm_runtime_resume(). Alan Stern > Kind regards and thank you very much in advance, > > Paul > >