Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp834463rdb; Fri, 26 Jan 2024 12:08:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IEtCzgFv+0cmgX7QOZyWS10jMDQRMXzHoIdHcH5k+y8nu7vCf0+PNN45SWzfmtJGS7IJQYl X-Received: by 2002:a05:6214:1c0c:b0:686:91e8:de65 with SMTP id u12-20020a0562141c0c00b0068691e8de65mr514047qvc.98.1706299712482; Fri, 26 Jan 2024 12:08:32 -0800 (PST) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id f11-20020a056214076b00b0068181e87595si1996300qvz.362.2024.01.26.12.08.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 12:08:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40606-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@intel.com header.s=Intel header.b=SfPMjKjI; arc=fail (body hash mismatch); spf=pass (google.com: domain of linux-kernel+bounces-40606-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40606-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1CDB01C243B3 for ; Fri, 26 Jan 2024 20:08:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B75A922EE9; Fri, 26 Jan 2024 20:08:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel.com header.i=@intel.com header.b="SfPMjKjI" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 28776225DA; Fri, 26 Jan 2024 20:08:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=198.175.65.10 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706299706; cv=fail; b=QCHND/M1w2Zq5adYjeFAaok6qtuOQcPeW+TgOLbzmaKQ5hwFpEl0oJW4FT3Kb8zFKDVJVnP3ZnTRTwZXCh+ij6Zfm8kjFdrvWaRdOGg/YluShKgX9T3VasJDapghUE8bNQb8TOg2MkSQbqbS1REpl6fNszD4ah0PpyEbJJHmkIg= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706299706; c=relaxed/simple; bh=mx1AnvTCKo4ejH4nV1bUgKrnmciI80CISdSrmRMAyRY=; h=Date:From:To:CC:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=WeCPzmZWoRDcoDzgDxeRtRvqZqjp5UrqpVJDxAgzLCmbqJDg3DzGnlqk0rCXNujezHPpEBt/zPIqcXRXvJpWGibFmeRMOP6fVLxGjwCbjPFSlMqGw+AA8xBBWGEmsdIzKH4A2I1uWM79O0R30S2/k6aSKv7fwrq5aFTh4moktN4= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=SfPMjKjI; arc=fail smtp.client-ip=198.175.65.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706299705; x=1737835705; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=mx1AnvTCKo4ejH4nV1bUgKrnmciI80CISdSrmRMAyRY=; b=SfPMjKjIB46IoxqrbsFzqE6YVmdJEnVNSBpjPvYUEPcp1pApaBzpOv7T R8o/+SMcvRND91w5SUwrwgdirnM4Q/qBxaNXUmVp+dTQerLKFz0gQ7gGl Hi5rrfNb4k2j7z63DG26jJuY4Usm22Mq1umWJ/BdaVgwq17JkM79qD+fp 1mtjCqSMV7JZKgmqFcyJmBwG8nZqNEqmJ5E07S8vemImxtFTV9wo3i5yN FGH0qxuEgOBeTydWNFsXCND3oZ5QWzNGAexUBwOomnzwVYsuiAWa3xTYb KsvCSnMEbr9zwFeI8nKqxghOPdTpfEmx79ZA9tTX9g9rXu3ZJBafsVrYw Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10964"; a="15925943" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="15925943" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2024 12:08:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="29187967" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmviesa001.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 26 Jan 2024 12:08:22 -0800 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 26 Jan 2024 12:08:22 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 26 Jan 2024 12:08:21 -0800 Received: from ORSEDG602.ED.cps.intel.com (10.7.248.7) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Fri, 26 Jan 2024 12:08:21 -0800 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.168) by edgegateway.intel.com (134.134.137.103) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 26 Jan 2024 12:08:21 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KkBNjvFRe2hbjv6FAzNFM7JvBJnvKDYqM8a+ZTzFOlEx3N1g8qhBsBc7eJuP0MAJHcRhakRiqQ8O0eex+JDRVhztPbMMNa3XFOBZIgmJDcznCSGXG/Vx/AF7YZn/rRlgwo5wDXZiYjUrltl/1eOSpACtCI+FK4rCTLFUyRiLF27Lkbll4dfK6I2zGJMWeKQJpMpJEC6zxHoh+9CzTV79XoWJFUmfZReJJL3qtlV9TayWLOJobEJIA/9N7VzQPFEZcMEcY0aBQC9ChMgk/BoiUxSDG79c6YbnNAGV8AoqPWt5A1cIihWVwk+wUXS4mQWLcWPUK4HXiKXYOCaGG+bWbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=J9Tb/f4jfaPz3/ez+dtIyGoa4+T2cAi0AOVHSqLgTbc=; b=Sdpu4zHtyWVzXkk0VZPSOQ5lwMmxZ3uSGi+t+NDRyPW+CepgyvcAWvHgKtVFLczsNnrxgoLSI5pCH7XSjDLkIzEgbS4neLaBfWk8TI32vbMWxr8T5IiXybEkLpWNyewaR0wJ5nQCINQo4pj9P/j32KKW84qxcgOp3xqm1+p8kdD4yLEQxh4/ufHAT/IkENUelznXfBwVV6iENJl381WzlsiFmzt7bIEQfhrgP35429AsAwMq9SpNi3qQ5+MweoqXMdoOh51hFuHEfCr6nM//i8pHPkzmFBvHICIwSkezaBVe38LuMf/PcYGwvZVqVM4GdSi+gev5IIyan5UovsQiUQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH8PR11MB8107.namprd11.prod.outlook.com (2603:10b6:510:256::6) by BN9PR11MB5466.namprd11.prod.outlook.com (2603:10b6:408:11f::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7228.27; Fri, 26 Jan 2024 20:08:17 +0000 Received: from PH8PR11MB8107.namprd11.prod.outlook.com ([fe80::6257:f90:c7dd:f0b2]) by PH8PR11MB8107.namprd11.prod.outlook.com ([fe80::6257:f90:c7dd:f0b2%4]) with mapi id 15.20.7202.035; Fri, 26 Jan 2024 20:08:16 +0000 Date: Fri, 26 Jan 2024 12:08:13 -0800 From: Dan Williams To: Greg KH , Dan Williams CC: Alistair Francis , , , , , , , , , , , , Alistair Francis Subject: Re: [PATCH v6 2/3] sysfs: Add a attr_is_visible function to attribute_group Message-ID: <65b4112db4de0_51c7f2943a@dwillia2-mobl3.amr.corp.intel.com.notmuch> References: <2023090142-circling-probably-7828@gregkh> <2023100539-playgroup-stoppable-d5d4@gregkh> <2023101113-swimwear-squealer-464c@gregkh> <2024012321-envious-procedure-4a58@gregkh> <65b1739b2c789_37ad294f5@dwillia2-xfh.jf.intel.com.notmuch> <65b400bf65c33_51c7f294c5@dwillia2-mobl3.amr.corp.intel.com.notmuch> <2024012631-removed-stuffed-ecc0@gregkh> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <2024012631-removed-stuffed-ecc0@gregkh> X-ClientProxiedBy: MW4P222CA0005.NAMP222.PROD.OUTLOOK.COM (2603:10b6:303:114::10) To PH8PR11MB8107.namprd11.prod.outlook.com (2603:10b6:510:256::6) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH8PR11MB8107:EE_|BN9PR11MB5466:EE_ X-MS-Office365-Filtering-Correlation-Id: 5dede7fa-662a-414e-06d2-08dc1eaa88b6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 72z5Oqo5nhdi/RNqd8QBhhlsaAlu+7qjtcwvfHob2/l4KQOFnEvZvDEROsrqRbOS+osUKWNTdn9/V9B+WfFc9tCQbwt8NpkLf7MhPUScrystSPRXTf75DU03KXwKNBkkVVwzTdJ/JP55N3myVvpVGgY6r+I804Jthn5jAvETMhHBWHEQ+nphTuL7n24F3XjGRkQNtbmSD/xkjaTcaVSOeg1OukOKHbSb5B4ayZkJ4SoRTfrWz0BAJIPDI6latM1W6TLqgh4FU5lw8/dXO3InuTRKTkyEkoj/WXjSGTIkddy3fEzXMym59vByITvrwN9761mr9kQc6fT8GoB62qVisLGL5sNS47vW0sxL0zKaYji8t1onLHePPXJVCFmcFfp3b0ri2IYtylkQW2oV48Yc0pe3d2X8zUlWyRjkDvH+6ZZmX8oHUkWZJG4KHKj1+XpsO9Y8gZo79LNx4jl0mJvUNEdH2ohrZkPv+JclI7dBFVBUGo5ha+BokwGa/FBLfqBCZlih3tKeMioI/OHoK0y6W6NaUZ/2RquBKP8gB/iGLBawwILHXhbbKrLpFOC1yBiS X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH8PR11MB8107.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(346002)(136003)(366004)(376002)(39860400002)(230922051799003)(451199024)(64100799003)(1800799012)(186009)(53546011)(110136005)(6666004)(6506007)(6512007)(9686003)(26005)(478600001)(6486002)(86362001)(66946007)(54906003)(316002)(66556008)(66476007)(8676002)(83380400001)(8936002)(4326008)(41300700001)(82960400001)(5660300002)(7416002)(2906002)(38100700002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?z8XS/ZBNI6JFfFB5g5R3r+H5ep3uKlyku+IzImiK/yF/lJCdbFSGvb1JQYTA?= =?us-ascii?Q?S9BMpXtxj/2x9oOUtPzsaS7U1lTgXeRizIJJhmuvHgqEce0SaRq8Of3t81sC?= =?us-ascii?Q?eMZDyl7EjLvwf/jXo91lo9ckvvWzSXvenmJE205lF9/QTo0Hl7rOVDl8qrxo?= =?us-ascii?Q?JgynFc/jYxJQfbH+TNk5piwPfBtIqFSv9LYnMGsPXsWLcQfFZZPQUGhWlvNo?= =?us-ascii?Q?mHpi+TB93pNvZw6YSvvYlSA+W6k0bz+QGersZp4mvCQrParwJm+eHqT/thMU?= =?us-ascii?Q?uMhGXC+5XEHjW7LM3dR05CAG8PTflkqBNgJz0TC4ymKh2grIybqzWnUw3LH2?= =?us-ascii?Q?AUjGx60XWVYnUVpJ1BWSwkRZ9qVDCgQ0CXLqMoepqoPcLtOwoW2r9MI/2Diq?= =?us-ascii?Q?8LBgqKTmSiz3Y27Runs5l1LQApggqgSmUlqngnr3U+ytkBQAyHIx0HFGTdg/?= =?us-ascii?Q?JbX14eA4vBLDPkWWCwE1kE3C8Jc1WWwne0neG66bgm9y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Aknzz7pecW0SCDzNCBGCfaCWrUHiyXh0IDX5Jjev0aYlPpR?= =?us-ascii?Q?KJ8ZY/PY6VqFHhHUaAfoTbpVLT8wwFlTZ7xQbbL/qPDaXiMOvLhCTmbirAvf?= =?us-ascii?Q?NVLXKNzGc2jsPZqdZPUFocCmjexaqK11Gvbv51D0bnsFVj9MuypX/E9eGvto?= =?us-ascii?Q?RtRLC1Cu+nTdzqimQjVCNndp6kpggi4YvDq8AdGtO5k+5lDUd6UzwvZFX4dh?= =?us-ascii?Q?ug=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 5dede7fa-662a-414e-06d2-08dc1eaa88b6 X-MS-Exchange-CrossTenant-AuthSource: PH8PR11MB8107.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2024 20:08:16.8127 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: joqtmAX/skuf8W+zbSaYoNR24j8YeIVdF+Ov6RPQ6PXh1G0JKGnOe5ANVqfUZYGpCfdekZBshdn0AV6HzcQnhqYMGmK8ga5F0d9ag4wVe14= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR11MB5466 X-OriginatorOrg: intel.com Greg KH wrote: > On Fri, Jan 26, 2024 at 10:58:07AM -0800, Dan Williams wrote: > > Dan Williams wrote: > > > Greg KH wrote: > > > [..] > > > > > > > > > > Hey Greg, > > > > > > > > > > I wanted to follow up on this and see if you are able to provide more > > > > > details for reproducing or if you are able to look into it? > > > > > > > > Last I tried this, it still crashed and would not boot either on my > > > > laptop or my workstation. I don't know how it is working properly for > > > > you, what systems have you tried it on? > > > > > > > > I'm not going to be able to look at this for many weeks due to > > > > conference stuff, so if you want to take the series and test it and > > > > hopefully catch my error, that would be great, I'd love to move forward > > > > and get this merged someday. > > > > > > I mentioned to Lukas that I was working on a "sysfs group visibility" > > > patch and he pointed me to this thread. I will note that I tried to make > > > the "hide group if all attributes are invisible" approach work, but > > > reverted to a "new is_group_visible() callback" approach. I did read > > > through the thread and try to improve the argument in the changelog > > > accordingly. > > > > > > I do admit to liking the cleanliness (not touching 'struct > > > attribute_group') of the "hide if no visible attribute" approch, but see > > > the criticism of that alternative below, and let me know if it is > > > convincing. I tested it locally with the following hack to make the > > > group disappear every other sysfs_update_group() event: > > > > Hey Greg, > > > > Ignore this version: > > > > --- > > From: Dan Williams > > Date: Tue, 23 Jan 2024 20:20:39 -0800 > > Subject: [PATCH] sysfs: Introduce is_group_visible() for attribute_groups > > --- > > > > I am going back to your approach without a new callback, and some fixups > > to avoid unintended directory removal. I will post that shortly with its > > consumer. > > Ignore it? I was just about to write an email that said "maybe this is > the right way forward" :) > > What happened to cause it to not be ok? And if you can find the bug in > the posted patch here, that would be great as well. It was an aha moment this morning that I could rely on something like: #define SYSFS_GROUP_INVISIBLE ((umode_t)-1) ..as the return value from either is_visible() or attr_is_visible() and not need to define a new is_group_visible() callback. The only downside I can see is that there is no way to know if the is_visible() handler might return SYSFS_GROUP_INVISIBLE to decide when to warn about deletion not finding anything to delete, or update not finding the existing node to update. I'll type it up and see how it looks, but if you're not worried about the is_group_visible() addition to 'struct atttribute_group' I think that way is less hacky than the above.