Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3502561imu; Mon, 10 Dec 2018 03:20:48 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xr8gN/RekisDOgKr8Qk280uA0B1EWMR2M799IJOdki3trQz4WeqnG9rHEFpjbEIVczPP0k X-Received: by 2002:a63:89c2:: with SMTP id v185mr9690277pgd.97.1544440848153; Mon, 10 Dec 2018 03:20:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544440848; cv=none; d=google.com; s=arc-20160816; b=VBxj1qUoeZvaIMUczgoFW8G3Laeia/tRWd/rqT5WdhEREdNW+mM5KKKVcA8UB0YwzH SdGWtmJzJIp7VxnNnzczXLmrpPEgh2ON9EG3AlfYUA7AF51lHDG563t1Efmdlzlloid6 zyZbyqEQre48ti4LFAS7wXvNN6trQOA+ZNZDJSObL/R+2W4Hqw9Fo+wOLrrnsF64B/o0 WFgfENPymX5+2meNWHwZzne9TQ7CApI4aWyUr47S0EZQ9o4QzSLRyql1wjDCB1N2Y9ZH hz2KJgJbXAqZKXeFHkJJVp4fPpbWcXJUw+Hxzv8pJtXTGNtvqsWC9JJGOD1JHeRtMmAs gCIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:mail-followup-to :message-id:subject:cc:to:from:date:dkim-signature; bh=fEL9YujWF4B2aja4h8eZO3WL8D2yjSsbHpUaNr1t0Ug=; b=y0pNqPAnk1omogCcZ5Z+T2eS1JD4m57MKadCey1PYZbbjFtsb+bhjtEidAcX2qVpq+ rRcvzKdhOBWxSZ1rX+GetOeBijhzWkJwRnqyPzeA7na6cfRBSb8TJl8bHWAvFM/ScMFe SqHXK2y32phHsUNnRNI4GYt1Nmj9UjhwGG1tV056AiBb2nxB3lMLpGh2S9hffpB6mlHn YbnnxlvqjKbkuKdX/7jA5qPwBDqTjbmt+Pp69xVCusXVAcIEa74QM+GuoBbwDmgTb74u i+Mhs3oDBJhtmvCExI/JWoAcGLAMAHHRuyEgFWW9/q8foijPneoSQZu5sXS7AwEMviYf tWfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=iqEwiosF; 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 v5si9823841pfe.52.2018.12.10.03.20.33; Mon, 10 Dec 2018 03:20:48 -0800 (PST) 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; dkim=fail header.i=@ffwll.ch header.s=google header.b=iqEwiosF; 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 S1727058AbeLJKVE (ORCPT + 99 others); Mon, 10 Dec 2018 05:21:04 -0500 Received: from mail-ed1-f66.google.com ([209.85.208.66]:37489 "EHLO mail-ed1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726475AbeLJKVD (ORCPT ); Mon, 10 Dec 2018 05:21:03 -0500 Received: by mail-ed1-f66.google.com with SMTP id h15so8989414edb.4 for ; Mon, 10 Dec 2018 02:21:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=fEL9YujWF4B2aja4h8eZO3WL8D2yjSsbHpUaNr1t0Ug=; b=iqEwiosF8GUx5+i5Od6ZwDX5sb1aiyAvsG0yC/eCzy8MUOYVIjJsvkTXlbCnP7O6wo hoh1QWdFLtcNGdpEsFgwW2S34SAwhuSjS3wysUYryIl1qOBe/Uhc72ADqiYQeBNI5arf v3teCq1DZIX4yF1q0GtSHflIUDBqHeOmcKW2s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to:user-agent; bh=fEL9YujWF4B2aja4h8eZO3WL8D2yjSsbHpUaNr1t0Ug=; b=s3NzCFHRIb465QORWIhaRF7C35WCLAMvWMlrj5UG52qSeee59bCDTittnUBX372c7W 2ydl9ygmWgUgIa9Nd2Nn1Uva1OYqGA9ubSOHQOtiDGwmNn3UIHnUEpapBF8Y9+Um4Hbp WFkjC4FSCi5+rgRNcldGmfXf+k/e3s7jCkhjTCZ9y/b/L4A83L7pkWiornixD0jXoeMJ 1Of8+Y2bHM00NqgTqQOWEszle7xW3Z/pjYC+KLmIOV3XzP3iYUpLYEm6oK/NeJu++fPD vnyQernkS9/xS5XYFbklxzAoUXue5WAC2bHphU7tpIEsmhttsF9zVxaM2RzRE++88+Lu MtWA== X-Gm-Message-State: AA+aEWbQUf39/Mm+ZUD8OX3SQVpWQvWVNsCPEsO6iBtgzcTyHLe8Nfbh 3lxPL5t9WQw6UIHioaQK4YZTJw== X-Received: by 2002:a50:b881:: with SMTP id l1mr11011347ede.167.1544437261858; Mon, 10 Dec 2018 02:21:01 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:569e:0:3106:d637:d723:e855]) by smtp.gmail.com with ESMTPSA id gp22-v6sm1732377ejb.4.2018.12.10.02.21.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Dec 2018 02:21:00 -0800 (PST) Date: Mon, 10 Dec 2018 11:20:58 +0100 From: Daniel Vetter To: Greg Kroah-Hartman Cc: Daniel Vetter , LKML , DRI Development , Ramalingam C , "Rafael J. Wysocki" , Daniel Vetter Subject: Re: [PATCH] drivers/base: use a worker for sysfs unbind Message-ID: <20181210102058.GO21184@phenom.ffwll.local> Mail-Followup-To: Greg Kroah-Hartman , LKML , DRI Development , Ramalingam C , "Rafael J. Wysocki" , Daniel Vetter References: <20181210084653.7268-1-daniel.vetter@ffwll.ch> <20181210100634.GA8836@kroah.com> <20181210101832.GN21184@phenom.ffwll.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181210101832.GN21184@phenom.ffwll.local> X-Operating-System: Linux phenom 4.18.0-2-amd64 User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Dec 10, 2018 at 11:18:32AM +0100, Daniel Vetter wrote: > On Mon, Dec 10, 2018 at 11:06:34AM +0100, Greg Kroah-Hartman wrote: > > On Mon, Dec 10, 2018 at 09:46:53AM +0100, Daniel Vetter wrote: > > > Drivers might want to remove some sysfs files, which needs the same > > > locks and ends up angering lockdep. Relevant snippet of the stack > > > trace: > > > > > > kernfs_remove_by_name_ns+0x3b/0x80 > > > bus_remove_driver+0x92/0xa0 > > > acpi_video_unregister+0x24/0x40 > > > i915_driver_unload+0x42/0x130 [i915] > > > i915_pci_remove+0x19/0x30 [i915] > > > pci_device_remove+0x36/0xb0 > > > device_release_driver_internal+0x185/0x250 > > > unbind_store+0xaf/0x180 > > > kernfs_fop_write+0x104/0x190 > > > > > > I've stumbled over this because some new patches by Ram connect the > > > snd-hda-intel unload (where we do use sysfs unbind) with the locking > > > chains in the i915 unload code (but without creating a new loop), > > > which upset our CI. But the bug is already there and can be easily > > > reproduced by unbind i915 directly. > > > > This is odd, why wouldn't any driver hit this issue? And why now since > > you say this is triggerable today? > > The above backtrace is triggered by unbinding i915 on current upstream > kernels. Note: Will crash later on rather badly in the > fbdev/fbcon/vtconsole hell, but that's separate issue (which can be worked > around by first unbinding fbcon manually through sysfs). > > > I know scsi was doing some strange things like trying to remove the > > device itself from a sysfs callback on the device, which requires it to > > just call a different kobject function created just for that type of > > thing. Would that also make sense to do here instead of your workqueue? > > Note how we blow up on unregistering sw device instances supported by i915 > in entirely different subsystems. I guess most drivers just have sysfs > files for their own stuff, where this is done as you describe. The problem > is that there's an awful lot of unrelated stuff hanging off i915. > > Or maybe acpi_video is busted, and should be using a different function. > You haven't said which one, and I have no idea which one it is ... > > And in case the context wasn't clear: This is unbinding the i915 pci > driver which triggers the above lockdep splat recursion. btw another option for "fixing" this would be to annotate the mutex_lock in kernfs_remove_by_name_ns as recursive. Which just shuts up lockdep (and might hide some real bugs), but would get the job done since there's not actually a deadlock here. Just lockdep being annoyed. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch