From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 9AE777F9; Thu, 7 Nov 2024 05:21:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730956880; cv=none; b=LENYGg9hdEDWuy1wvheYJ/544oaV4tMKP//gXXHhWPoaYJXiJetWQSCWpALra8mXrI3i+rvGStRehiJqO8gjfJsV1/SzUPZtK5htckjmXYfYZZfrZInz2Le1fluze4xFCqKvSBFaV5wgUtvGKlavxwerC6XakolkLF5EkKf8k2g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730956880; c=relaxed/simple; bh=LcTJNuAS+0u64bln2s0a89deCwW+g5Nrojs1Slddt/Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LO99nVgrqp4dw8p7qVK2jfBGh9eIGIKpk+5etsZf8dDM4FuysxBcQqw9KiQ50cVPfbyh+tkJ0iWPxTiNl4jjq32Jd09oczcLL3oO5hJbTM4BO+AGpzvwEMvd2nIpBFFZkARR2Qc3MqlHhUGPsC0kbPNRCn7myndMAHw2yhsTfVA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=LqZ6urMl; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="LqZ6urMl" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 064BBC4CECC; Thu, 7 Nov 2024 05:21:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1730956880; bh=LcTJNuAS+0u64bln2s0a89deCwW+g5Nrojs1Slddt/Q=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LqZ6urMldxlvEBhdUM/g9ay6JBw8MxGPCgUReHarZ5Rrrup6qtaAMbkDd8Ut3yIvJ TB3aWEUF8ij6xyiKo01mFPXSemUmYSpWT2Gfca8HAeh7vk2NMp5wXiqsR3jTvujmXl Vml1yQf1y5lU0zvuowqmi415BENx3kOsFR8a5uB8= Date: Thu, 7 Nov 2024 06:21:00 +0100 From: Greg Kroah-Hartman To: Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= Cc: Thomas =?iso-8859-1?Q?Wei=DFschuh?= , "Rafael J. Wysocki" , Bjorn Helgaas , Srinivas Kandagatla , Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Ira Weiny , Alex Deucher , Christian =?iso-8859-1?Q?K=F6nig?= , Xinhui Pan , David Airlie , Simona Vetter , Dennis Dalessandro , Jason Gunthorpe , Leon Romanovsky , Tudor Ambarus , Pratyush Yadav , Michael Walle , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Naveen Krishna Chatradhi , Carlos Bilbao , Hans de Goede , Ilpo =?iso-8859-1?Q?J=E4rvinen?= , "David E. Box" , "James E.J. Bottomley" , "Martin K. Petersen" , Richard Henderson , Matt Turner , Frederic Barrat , Andrew Donnellan , Arnd Bergmann , Logan Gunthorpe , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , Dan Williams , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-cxl@vger.kernel.org, amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-rdma@vger.kernel.org, linux-mtd@lists.infradead.org, platform-driver-x86@vger.kernel.org, linux-scsi@vger.kernel.org, linux-usb@vger.kernel.org, linux-alpha@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-hyperv@vger.kernel.org Subject: Re: [PATCH v2 02/10] sysfs: introduce callback attribute_group::bin_size Message-ID: <2024110726-hasty-obsolete-3780@gregkh> References: <20241103-sysfs-const-bin_attr-v2-0-71110628844c@weissschuh.net> <20241103-sysfs-const-bin_attr-v2-2-71110628844c@weissschuh.net> <20241106200513.GB174958@rocinante> Precedence: bulk X-Mailing-List: linux-alpha@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20241106200513.GB174958@rocinante> On Thu, Nov 07, 2024 at 05:05:13AM +0900, Krzysztof WilczyƄski wrote: > Hello, > > > Several drivers need to dynamically calculate the size of an binary > > attribute. Currently this is done by assigning attr->size from the > > is_bin_visible() callback. > > > > This has drawbacks: > > * It is not documented. > > * A single attribute can be instantiated multiple times, overwriting the > > shared size field. > > * It prevents the structure to be moved to read-only memory. > > > > Introduce a new dedicated callback to calculate the size of the > > attribute. > > Would it be possible to have a helper that when run against a specific > kobject reference, then it would refresh or re-run the size callbacks? > > We have an use case where we resize BARs on demand via sysfs, and currently > the only way to update the size of each resource sysfs object is to remove > and added them again, which is a bit crude, and can also be unsafe. How is it unsafe? > Hence the question. > > There exist the sysfs_update_groups(), but the BAR resource sysfs objects > are currently, at least not yet, added to any attribute group. then maybe they should be added to one :) thanks, greg k-h