public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation•org>
To: "Krzysztof Wilczyński" <kw@linux•com>
Cc: "Thomas Weißschuh" <linux@weissschuh•net>,
	"Rafael J. Wysocki" <rafael@kernel•org>,
	"Bjorn Helgaas" <bhelgaas@google•com>,
	"Srinivas Kandagatla" <srinivas.kandagatla@linaro•org>,
	"Davidlohr Bueso" <dave@stgolabs•net>,
	"Jonathan Cameron" <jonathan.cameron@huawei•com>,
	"Dave Jiang" <dave.jiang@intel•com>,
	"Alison Schofield" <alison.schofield@intel•com>,
	"Vishal Verma" <vishal.l.verma@intel•com>,
	"Ira Weiny" <ira.weiny@intel•com>,
	"Alex Deucher" <alexander.deucher@amd•com>,
	"Christian König" <christian.koenig@amd•com>,
	"Xinhui Pan" <Xinhui.Pan@amd•com>,
	"David Airlie" <airlied@gmail•com>,
	"Simona Vetter" <simona@ffwll•ch>,
	"Dennis Dalessandro" <dennis.dalessandro@cornelisnetworks•com>,
	"Jason Gunthorpe" <jgg@ziepe•ca>,
	"Leon Romanovsky" <leon@kernel•org>,
	"Tudor Ambarus" <tudor.ambarus@linaro•org>,
	"Pratyush Yadav" <pratyush@kernel•org>,
	"Michael Walle" <mwalle@kernel•org>,
	"Miquel Raynal" <miquel.raynal@bootlin•com>,
	"Richard Weinberger" <richard@nod•at>,
	"Vignesh Raghavendra" <vigneshr@ti•com>,
	"Naveen Krishna Chatradhi" <naveenkrishna.chatradhi@amd•com>,
	"Carlos Bilbao" <carlos.bilbao.osdev@gmail•com>,
	"Hans de Goede" <hdegoede@redhat•com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux•intel.com>,
	"David E. Box" <david.e.box@linux•intel.com>,
	"James E.J. Bottomley" <James.Bottomley@hansenpartnership•com>,
	"Martin K. Petersen" <martin.petersen@oracle•com>,
	"Richard Henderson" <richard.henderson@linaro•org>,
	"Matt Turner" <mattst88@gmail•com>,
	"Frederic Barrat" <fbarrat@linux•ibm.com>,
	"Andrew Donnellan" <ajd@linux•ibm.com>,
	"Arnd Bergmann" <arnd@arndb•de>,
	"Logan Gunthorpe" <logang@deltatee•com>,
	"K. Y. Srinivasan" <kys@microsoft•com>,
	"Haiyang Zhang" <haiyangz@microsoft•com>,
	"Wei Liu" <wei.liu@kernel•org>,
	"Dexuan Cui" <decui@microsoft•com>,
	"Dan Williams" <dan.j.williams@intel•com>,
	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
Date: Thu, 7 Nov 2024 06:21:00 +0100	[thread overview]
Message-ID: <2024110726-hasty-obsolete-3780@gregkh> (raw)
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


  reply	other threads:[~2024-11-07  5:21 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-03 17:03 [PATCH v2 00/10] sysfs: constify struct bin_attribute (Part 1) Thomas Weißschuh
2024-11-03 17:03 ` [PATCH v2 01/10] sysfs: explicitly pass size to sysfs_add_bin_file_mode_ns() Thomas Weißschuh
2024-11-03 17:03 ` [PATCH v2 02/10] sysfs: introduce callback attribute_group::bin_size Thomas Weißschuh
2024-11-05 16:12   ` Bjorn Helgaas
2024-11-06 19:27   ` Armin Wolf
2024-11-06 20:05   ` Krzysztof Wilczyński
2024-11-07  5:21     ` Greg Kroah-Hartman [this message]
2024-11-07 15:50       ` Krzysztof Wilczyński
2024-11-03 17:03 ` [PATCH v2 03/10] PCI/sysfs: Calculate bin_attribute size through bin_size() Thomas Weißschuh
2024-11-07 16:27   ` Bjorn Helgaas
2024-11-03 17:03 ` [PATCH v2 04/10] nvmem: core: calculate " Thomas Weißschuh
2024-11-08  9:58   ` Srinivas Kandagatla
2024-11-03 17:03 ` [PATCH v2 05/10] sysfs: treewide: constify attribute callback of bin_is_visible() Thomas Weißschuh
2024-11-04 13:25   ` Ilpo Järvinen
2024-11-04 13:52   ` Jason Gunthorpe
2024-11-04 14:56   ` Ira Weiny
2024-11-05  1:25   ` Martin K. Petersen
2024-11-05 15:26   ` Bjorn Helgaas
2024-11-07 17:20   ` Pratyush Yadav
2024-11-08  9:57   ` Srinivas Kandagatla
2024-11-03 17:03 ` [PATCH v2 06/10] sysfs: treewide: constify attribute callback of bin_attribute::mmap() Thomas Weißschuh
2024-11-04  1:24   ` Andrew Donnellan
2024-11-03 17:03 ` [PATCH v2 07/10] sysfs: treewide: constify attribute callback of bin_attribute::llseek() Thomas Weißschuh
2024-11-03 17:03 ` [PATCH v2 08/10] sysfs: implement all BIN_ATTR_* macros in terms of __BIN_ATTR() Thomas Weißschuh
2024-11-03 17:03 ` [PATCH v2 09/10] sysfs: bin_attribute: add const read/write callback variants Thomas Weißschuh
2024-12-03 16:06   ` James Bottomley
2024-12-03 16:11     ` Thomas Weißschuh
2024-11-03 17:03 ` [PATCH v2 10/10] driver core: Constify attribute arguments of binary attributes Thomas Weißschuh
2024-11-03 20:02 ` [PATCH v2 00/10] sysfs: constify struct bin_attribute (Part 1) Krzysztof Wilczyński
2024-11-05 16:15 ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2024110726-hasty-obsolete-3780@gregkh \
    --to=gregkh@linuxfoundation$(echo .)org \
    --cc=James.Bottomley@hansenpartnership$(echo .)com \
    --cc=Xinhui.Pan@amd$(echo .)com \
    --cc=airlied@gmail$(echo .)com \
    --cc=ajd@linux$(echo .)ibm.com \
    --cc=alexander.deucher@amd$(echo .)com \
    --cc=alison.schofield@intel$(echo .)com \
    --cc=amd-gfx@lists$(echo .)freedesktop.org \
    --cc=arnd@arndb$(echo .)de \
    --cc=bhelgaas@google$(echo .)com \
    --cc=carlos.bilbao.osdev@gmail$(echo .)com \
    --cc=christian.koenig@amd$(echo .)com \
    --cc=dan.j.williams@intel$(echo .)com \
    --cc=dave.jiang@intel$(echo .)com \
    --cc=dave@stgolabs$(echo .)net \
    --cc=david.e.box@linux$(echo .)intel.com \
    --cc=decui@microsoft$(echo .)com \
    --cc=dennis.dalessandro@cornelisnetworks$(echo .)com \
    --cc=dri-devel@lists$(echo .)freedesktop.org \
    --cc=fbarrat@linux$(echo .)ibm.com \
    --cc=haiyangz@microsoft$(echo .)com \
    --cc=hdegoede@redhat$(echo .)com \
    --cc=ilpo.jarvinen@linux$(echo .)intel.com \
    --cc=ira.weiny@intel$(echo .)com \
    --cc=jgg@ziepe$(echo .)ca \
    --cc=jonathan.cameron@huawei$(echo .)com \
    --cc=kw@linux$(echo .)com \
    --cc=kys@microsoft$(echo .)com \
    --cc=leon@kernel$(echo .)org \
    --cc=linux-alpha@vger$(echo .)kernel.org \
    --cc=linux-cxl@vger$(echo .)kernel.org \
    --cc=linux-hyperv@vger$(echo .)kernel.org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-mtd@lists$(echo .)infradead.org \
    --cc=linux-pci@vger$(echo .)kernel.org \
    --cc=linux-rdma@vger$(echo .)kernel.org \
    --cc=linux-scsi@vger$(echo .)kernel.org \
    --cc=linux-usb@vger$(echo .)kernel.org \
    --cc=linux@weissschuh$(echo .)net \
    --cc=linuxppc-dev@lists$(echo .)ozlabs.org \
    --cc=logang@deltatee$(echo .)com \
    --cc=martin.petersen@oracle$(echo .)com \
    --cc=mattst88@gmail$(echo .)com \
    --cc=miquel.raynal@bootlin$(echo .)com \
    --cc=mwalle@kernel$(echo .)org \
    --cc=naveenkrishna.chatradhi@amd$(echo .)com \
    --cc=platform-driver-x86@vger$(echo .)kernel.org \
    --cc=pratyush@kernel$(echo .)org \
    --cc=rafael@kernel$(echo .)org \
    --cc=richard.henderson@linaro$(echo .)org \
    --cc=richard@nod$(echo .)at \
    --cc=simona@ffwll$(echo .)ch \
    --cc=srinivas.kandagatla@linaro$(echo .)org \
    --cc=tudor.ambarus@linaro$(echo .)org \
    --cc=vigneshr@ti$(echo .)com \
    --cc=vishal.l.verma@intel$(echo .)com \
    --cc=wei.liu@kernel$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox