Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752173AbcLEUAn (ORCPT ); Mon, 5 Dec 2016 15:00:43 -0500 Received: from ec2-52-27-115-49.us-west-2.compute.amazonaws.com ([52.27.115.49]:46263 "EHLO osg.samsung.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751241AbcLEUAm (ORCPT ); Mon, 5 Dec 2016 15:00:42 -0500 Subject: Re: [PATCH] usbip: fix warning in vhci_hcd_probe/lockdep_init_map To: Andrey Konovalov References: <20161205195638.7005-1-shuahkh@osg.samsung.com> Cc: gregkh@linuxfoundation.org, valentina.manea.m@gmail.com, shuah@kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan From: Shuah Khan Message-ID: <4a3b7e4f-6b5c-d9e8-f26c-1286d4e1f630@osg.samsung.com> Date: Mon, 5 Dec 2016 13:00:31 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <20161205195638.7005-1-shuahkh@osg.samsung.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2757 Lines: 64 Hi Andrey, On 12/05/2016 12:56 PM, Shuah Khan wrote: > vhci_hcd calls sysfs_create_group() with dynamically allocated sysfs > attributes triggering the lock-class key not persistent warning. Call > sysfs_attr_init() for dynamically allocated sysfs attributes to fix it. > > vhci_hcd vhci_hcd: USB/IP Virtual Host Controller > vhci_hcd vhci_hcd: new USB bus registered, assigned bus number 2 > BUG: key ffff88006a7e8d18 not in .data! > ------------[ cut here ]------------ > WARNING: CPU: 0 PID: 1 at kernel/locking/lockdep.c:3131 > lockdep_init_map+0x60c/0x770 > DEBUG_LOCKS_WARN_ON(1)[ 1.567044] Modules linked in: > CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.9.0-rc7+ #58 > Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 > ffff88006bce6eb8 ffffffff81f96c8a ffffffff00000a02 1ffff1000d79cd6a > ffffed000d79cd62 000000046bce6ed8 0000000041b58ab3 ffffffff8598af40 > ffffffff81f969f8 0000000000000000 0000000041b58ab3 0000000000000200 > Call Trace: > [< inline >] __dump_stack lib/dump_stack.c:15 > [] dump_stack+0x292/0x398 lib/dump_stack.c:51 > [] __warn+0x19f/0x1e0 kernel/panic.c:550 > [] warn_slowpath_fmt+0xc5/0x110 kernel/panic.c:565 > [] lockdep_init_map+0x60c/0x770 kernel/locking/lockdep.c:3131 > [] __kernfs_create_file+0x114/0x2a0 fs/kernfs/file.c:954 > [] sysfs_add_file_mode_ns+0x225/0x520 fs/sysfs/file.c:305 > [< inline >] create_files fs/sysfs/group.c:64 > [] internal_create_group+0x239/0x8f0 fs/sysfs/group.c:134 > [] sysfs_create_group+0x1f/0x30 fs/sysfs/group.c:156 > [] vhci_start+0x5b4/0x7a0 drivers/usb/usbip/vhci_hcd.c:978 > [] usb_add_hcd+0x8da/0x1c60 drivers/usb/core/hcd.c:2867 > [] vhci_hcd_probe+0x97/0x130 > drivers/usb/usbip/vhci_hcd.c:1103 > --- > --- > ---[ end trace c33c7b202cf3aac8 ]--- > > Signed-off-by: Shuah Khan > Reported-by: Andrey Konovalov Here is the fix. Fixed the warning I reproduced on my system. Let me know if it works for you. thanks, -- Shuah > --- > drivers/usb/usbip/vhci_sysfs.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/usb/usbip/vhci_sysfs.c b/drivers/usb/usbip/vhci_sysfs.c > index c404017..b96e5b1 100644 > --- a/drivers/usb/usbip/vhci_sysfs.c > +++ b/drivers/usb/usbip/vhci_sysfs.c > @@ -361,6 +361,7 @@ static void set_status_attr(int id) > status->attr.attr.name = status->name; > status->attr.attr.mode = S_IRUGO; > status->attr.show = status_show; > + sysfs_attr_init(&status->attr.attr); > } > > static int init_status_attrs(void) >