Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6068249rdb; Thu, 14 Dec 2023 07:34:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IFsBk5QBoVdcVv0zXfnqJjiOh9/YKQoJ6/ecp9bapINa0cM73nWBWcNS779aQXKFTN8FIcl X-Received: by 2002:a17:902:a9c4:b0:1d0:a9d3:8f33 with SMTP id b4-20020a170902a9c400b001d0a9d38f33mr3834793plr.45.1702568044034; Thu, 14 Dec 2023 07:34:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702568044; cv=none; d=google.com; s=arc-20160816; b=MKFUYh87sC2+qYDvqyVKDd3NCuNNiDnQzLam3RXu839JyjMplbjoFCYW09K4c+41VJ joei3ZHkUpbj6WaSPd4Jz4nJ4S64YVGhKDVqSS471VH5cpXKW+CUcSaCEitqCgC2tehp wzh/gXAaswdufmeU0AcI9RiIHICaKaNUO7dB7kaKkZ68eyGcZ5v43PKlFN4xMWo3rbOs 1i3e+poxiW9omG6utW/8orsQMLP9TIn0CA6yxhPMy0NYXalEYHiwBc6PGO3u+roNTAts aieBrc35Ht1wroAz24cGJtiM85UhdlS9yq+3HaHNPz32wA/DYZmRHodt2glgdPifOMY0 XHTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=t7gcbQosxpK2BZgtLfSQNUhYBmg7H6/i1+aDNN+xvts=; fh=6PCBDuBfBhhsZSwVw2mshsfF+2ff2uoEQhkfXeyV4HI=; b=nQHVAHHYNyccRy0cvzAfufDM3Z+nhQjG7q84ov7Bp6DZ+tLRY9nN2MhWg84pKCtHg/ tcMnk9dmChItAC2SmGn30qZCf4cearxYqnQaAQauGDo39IweF+5lu0PwVExq8LDqadOJ 29vqsRpiwuuWbJjGP13xYcbYCfdUu5iPG4oYtzTun8OS7yr21gBQbuQ3SyfM9N107ExA xWi7WVa1gKU4RRIERFka5l8i8lAG4IZ28IZVSl/F40Lq4s2YRhvzFW5Tqy6eqBF+mkTg EHHvCQeZdRLLIeZG+6iSzYKbAF0BLac8oTUerKTiiIu3w7C108/tDir+c1GmxtGyiphD P/lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XTdkSdM1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id x19-20020a170902b41300b001d0c442d76dsi11472330plr.246.2023.12.14.07.34.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 07:34:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XTdkSdM1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id A6E9F852683D; Thu, 14 Dec 2023 07:33:58 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573793AbjLNPdo (ORCPT + 99 others); Thu, 14 Dec 2023 10:33:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573757AbjLNPdn (ORCPT ); Thu, 14 Dec 2023 10:33:43 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28E9D10F for ; Thu, 14 Dec 2023 07:33:50 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6B1B7C433C7; Thu, 14 Dec 2023 15:33:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1702568029; bh=3dRVPojxVarxqc+k64+h1j/nb68HVbqD8FQgiohBXbA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XTdkSdM1sLzi4D/PSBmJ2eDH19Bmp4X+y6BgJ1F+GShGRM/Cw/ypKQnB9w8xbS4Xu CfX5oreZxh4gy08/z77Gy3aRf/0oHo1S1w0oZnvwEsfrfYcepS9/iwpPTNyn5Mtl2x HkAJlUHreRrUpbQiCjy1h/wWRPLQ19pRl+imLyBk= Date: Thu, 14 Dec 2023 16:33:47 +0100 From: Greg KH To: Dan Williams Cc: Vishal Verma , Ira Weiny , Peter Zijlstra , Andrew Morton , linux-kernel@vger.kernel.org, linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev Subject: Re: [PATCH] driver core: Add a guard() definition for the device_lock() Message-ID: <2023121456-violation-unthawed-3ae3@gregkh> References: <170250854466.1522182.17555361077409628655.stgit@dwillia2-xfh.jf.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <170250854466.1522182.17555361077409628655.stgit@dwillia2-xfh.jf.intel.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 14 Dec 2023 07:33:58 -0800 (PST) On Wed, Dec 13, 2023 at 03:02:35PM -0800, Dan Williams wrote: > At present there are ~200 usages of device_lock() in the kernel. Some of > those usages lead to "goto unlock;" patterns which have proven to be > error prone. Define a "device" guard() definition to allow for those to > be cleaned up and prevent new ones from appearing. > > Link: http://lore.kernel.org/r/657897453dda8_269bd29492@dwillia2-mobl3.amr.corp.intel.com.notmuch > Link: http://lore.kernel.org/r/6577b0c2a02df_a04c5294bb@dwillia2-xfh.jf.intel.com.notmuch > Cc: Vishal Verma > Cc: Ira Weiny > Cc: Peter Zijlstra > Cc: Greg Kroah-Hartman > Cc: Andrew Morton > Signed-off-by: Dan Williams > --- > Hi Greg, > > I wonder if you might include this change in v6.7-rc to ease some patch > sets alternately going through my tree and Andrew's tree. Those > discussions are linked above. Alternately I can can just take it through > my tree with your ack and the other use case can circle back to it in > the v6.9 cycle. Sure, I'll queue it up now for 6.7-final, makes sense to have it now for others to build off of, and for me to fix up some places in the driver core to use it as well. > I considered also defining a __free() helper similar to __free(mutex), > but I think "__free(device)" would be a surprising name for something > that drops a lock. Also, I like the syntax of guard(device) over > something like guard(device_lock) since a 'struct device *' is the > argument, not a lock type, but I'm open to your or Peter's thoughts on > the naming. guard(device); makes sense to me, as that's what you are doing here, so I'm good with it. thanks, greg k-h