Thread (28 messages) 28 messages, 11 authors, 2024-12-03

Re: [PATCH v2 02/10] sysfs: introduce callback attribute_group::bin_size

From: Krzysztof Wilczyński <hidden>
Date: 2024-11-06 20:05:16
Also in: amd-gfx, dri-devel, linux-alpha, linux-cxl, linux-hyperv, linux-pci, linux-rdma, linux-scsi, linux-usb, lkml, platform-driver-x86

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.

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.

Thank you!

	Krzysztof
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help