From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9781CC4646D for ; Mon, 13 Aug 2018 07:57:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 55E2421834 for ; Mon, 13 Aug 2018 07:57:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 55E2421834 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728610AbeHMKib (ORCPT ); Mon, 13 Aug 2018 06:38:31 -0400 Received: from mx2.suse.de ([195.135.220.15]:45432 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726704AbeHMKib (ORCPT ); Mon, 13 Aug 2018 06:38:31 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 8DBE8ACEF; Mon, 13 Aug 2018 07:57:23 +0000 (UTC) Message-ID: <1534146566.10070.5.camel@suse.com> Subject: Re: [Query] USB device autosuspend and its runtime usage count. From: Oliver Neukum To: Anshuman Gupta , linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org Date: Mon, 13 Aug 2018 09:49:26 +0200 In-Reply-To: <1534142758-387-1-git-send-email-anshuman.gupta@intel.com> References: <1534142758-387-1-git-send-email-anshuman.gupta@intel.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mo, 2018-08-13 at 12:15 +0530, Anshuman Gupta wrote: > Hi , > I need to test a functionality with USB autosuspend with latest kernel > Linux 4.18-rc8. I am trying to autosuspend a USB key board, i enabled > its autosuspend by doing echo "auto" to its "control" attributes. > I am expecting USB keyboard to go to autosuspend after autosuspend_delay_ms. > But USB key board is not going to autosuspend because its runtime usage > count is not equal to zero. > > Below are the log snippets: > > root@intel-Kabylake-Client-platform:# cat /sys/bus/usb/devices/1-5/power/runtime_enabled > enabled > root@intel-Kabylake-Client-platform:# cat /sys/bus/usb/devices/1-5/power/control > auto > root@intel-Kabylake-Client-platform:# cat /sys/bus/usb/devices/1-5/power/autosuspend_delay_ms > 2000 > root@intel-Kabylake-Client-platform:# cat /sys/bus/usb/devices/1-5/power/runtime_status > active > root@intel-Kabylake-Client-platform:# cat /sys/bus/usb/devices/1-5/power/runtime_usage > 1 > root@intel-Kabylake-Client-platform:# sleep 60; cat /sys/bus/usb/devices/1-5/power/runtime_usage > 1 > > My USB keyboard runtime usage reference count is not decreasing to zero. > Here am i missing something regarding runtime usage count or is it some issue with > my kernel or OS? Very hard to say without further information. Is the HID device the only interface of the whole device? Does the device support remote wakeup? Is an LED on? Usbhid does support autosuspend, but its criteria must be met. And all interface drivers must call the device idle. Or you have discovered a kernel bug. Regards Oliver