linux/drivers/hv
Naman Jain c7f864d345 Drivers: hv: Make the sysfs node size for the ring buffer dynamic
commit 65995e97a1 upstream.

The ring buffer size varies across VMBus channels. The size of sysfs
node for the ring buffer is currently hardcoded to 4 MB. Userspace
clients either use fstat() or hardcode this size for doing mmap().
To address this, make the sysfs node size dynamic to reflect the
actual ring buffer size for each channel. This will ensure that
fstat() on ring sysfs node always returns the correct size of
ring buffer.

Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Tested-by: Michael Kelley <mhklinux@outlook.com>
Reviewed-by: Dexuan Cui <decui@microsoft.com>
Signed-off-by: Naman Jain <namjain@linux.microsoft.com>
Link: https://lore.kernel.org/r/20250502074811.2022-3-namjain@linux.microsoft.com
[ The structure "struct attribute_group" does not have bin_size field in
  v6.12.x kernel so the logic of configuring size of sysfs node for ring buffer
  has been moved to vmbus_chan_bin_attr_is_visible().
  Original change was not a fix, but it needs to be backported to fix size
  related discrepancy caused by the commit mentioned in Fixes tag. ]
Signed-off-by: Naman Jain <namjain@linux.microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2025-08-01 09:48:47 +01:00
..
channel.c Drivers: hv: vmbus: Remove vmbus_sendpacket_pagebuffer() 2025-05-22 14:29:48 +02:00
channel_mgmt.c Drivers: hv: vmbus: Add utility function for querying ring size 2024-04-11 14:55:53 +02:00
connection.c Drivers: hv: Allocate interrupt and monitor pages aligned to system page boundary 2025-06-27 11:11:24 +01:00
hv.c Drivers: hv: vmbus: Fix the misplaced function description 2024-08-03 00:13:01 +00:00
hv_balloon.c mm/memory_hotplug: initialize memmap of !ZONE_DEVICE with PageOffline() instead of PageReserved() 2024-07-03 19:30:18 -07:00
hv_common.c printk: Add a short description string to kmsg_dump() 2024-07-17 12:35:24 +02:00
hv_debugfs.c hv_debugfs: Make hv_debug_root static 2020-04-04 17:47:43 +01:00
hv_kvp.c Drivers: hv: util: Avoid accessing a ringbuffer not initialized yet 2024-12-27 14:02:15 +01:00
hv_snapshot.c Drivers: hv: util: Avoid accessing a ringbuffer not initialized yet 2024-12-27 14:02:15 +01:00
hv_trace.c hv: add SPDX license to trace 2018-03-28 13:24:56 +02:00
hv_trace.h Drivers: hv: vmbus: Drivers: hv: vmbus: Introduce CHANNELMSG_MODIFYCHANNEL_RESPONSE 2021-04-18 13:03:11 +00:00
hv_trace_balloon.h hv_balloon: trace post_status 2018-03-06 09:57:17 -08:00
hv_util.c Drivers: hv: util: Avoid accessing a ringbuffer not initialized yet 2024-12-27 14:02:15 +01:00
hv_utils_transport.c Drivers: hv: utils: Make use of the helper macro LIST_HEAD() 2022-02-09 14:33:21 +00:00
hv_utils_transport.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 280 2019-06-05 17:36:36 +02:00
hyperv_vmbus.h uio_hv_generic: Fix sysfs creation path for ring buffer 2025-05-22 14:29:36 +02:00
Kconfig x86/hyperv: Use per cpu initial stack for vtl context 2024-03-08 23:40:09 +00:00
Makefile Drivers: hv: Remove fcopy driver 2024-04-11 14:55:53 +02:00
ring_buffer.c Drivers: hv: vmbus: Remove second way of mapping ring buffers 2023-04-17 19:19:04 +00:00
vmbus_drv.c Drivers: hv: Make the sysfs node size for the ring buffer dynamic 2025-08-01 09:48:47 +01:00