* [PATCH] sysfs, acpi, tables: Set file size for each ACPI table
@ 2013-11-19 8:54 HATAYAMA Daisuke
2013-11-20 22:38 ` Toshi Kani
2013-11-21 3:48 ` Zhang Rui
0 siblings, 2 replies; 4+ messages in thread
From: HATAYAMA Daisuke @ 2013-11-19 8:54 UTC (permalink / raw)
To: lenb, rjw; +Cc: linux-acpi, Linux Kernel Mailing List
Currently, each of the ACPI tables exported from
/sys/firmware/acpi/tables is of zero size:
$ LANG=C ls -ld /sys/firmware/acpi/tables/*
-r-------- 1 root root 0 Nov 19 09:48 /sys/firmware/acpi/tables/APIC
-r-------- 1 root root 0 Nov 19 09:48 /sys/firmware/acpi/tables/BOOT
-r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/DSDT
-r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/FACP
-r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/FACS
-r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/MCFG
-r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/SRAT
drwxr-xr-x 2 root root 0 Nov 19 09:48 /sys/firmware/acpi/tables/dynamic/
due to which, user-land tools fail reading each table. For example:
$ acpidump -f /sys/firmware/acpi/tables/SRAT
Could not get input file size: /sys/firmware/acpi/tables/SRAT
To deal with the issue, this patch assigns size of each ACPI table to
the corresponding sysfs file.
$ LANG=C ls -hld /sys/firmware/acpi/tables/*
-r-------- 1 root root 94 Nov 19 16:45 /sys/firmware/acpi/tables/APIC
-r-------- 1 root root 40 Nov 19 16:45 /sys/firmware/acpi/tables/BOOT
-r-------- 1 root root 58K Nov 19 16:55 /sys/firmware/acpi/tables/DSDT
-r-------- 1 root root 244 Nov 19 16:55 /sys/firmware/acpi/tables/FACP
-r-------- 1 root root 64 Nov 19 16:55 /sys/firmware/acpi/tables/FACS
-r-------- 1 root root 60 Nov 19 16:55 /sys/firmware/acpi/tables/MCFG
-r-------- 1 root root 168 Nov 19 16:45 /sys/firmware/acpi/tables/SRAT
drwxr-xr-x 2 root root 0 Nov 19 16:55 /sys/firmware/acpi/tables/dynamic/
Then, user-land tools work well like:
$ acpidump -f /sys/firmware/acpi/tables/SRAT
SRAT @ 0x0000000000000000
0000: 53 52 41 54 A8 00 00 00 02 65 56 4D 57 41 52 45 SRAT.....eVMWARE
0010: 4D 45 4D 50 4C 55 47 20 00 00 04 06 56 4D 57 20 MEMPLUG ....VMW
0020: 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ................
0030: 01 28 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .(..............
0040: 00 00 0A 00 00 00 00 00 00 00 00 00 01 00 00 00 ................
0050: 00 00 00 00 00 00 00 00 01 28 00 00 00 00 00 00 .........(......
0060: 00 00 10 00 00 00 00 00 00 00 F0 BF 00 00 00 00 ................
0070: 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ................
0080: 01 28 00 00 00 00 00 00 00 00 00 00 01 00 00 00 .(..............
0090: 00 00 00 40 00 00 00 00 00 00 00 00 01 00 00 00 ...@............
00A0: 00 00 00 00 00 00 00 00 ........
Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
---
drivers/acpi/sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
index 05306a5..095ff1f 100644
--- a/drivers/acpi/sysfs.c
+++ b/drivers/acpi/sysfs.c
@@ -309,7 +309,7 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr,
sprintf(table_attr->name + ACPI_NAME_SIZE, "%d",
table_attr->instance);
- table_attr->attr.size = 0;
+ table_attr->attr.size = table_header->length;
table_attr->attr.read = acpi_table_show;
table_attr->attr.attr.name = table_attr->name;
table_attr->attr.attr.mode = 0400;
--
1.8.3.1
--
Thanks.
HATAYAMA, Daisuke
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] sysfs, acpi, tables: Set file size for each ACPI table
2013-11-19 8:54 [PATCH] sysfs, acpi, tables: Set file size for each ACPI table HATAYAMA Daisuke
@ 2013-11-20 22:38 ` Toshi Kani
2013-11-21 0:32 ` Rafael J. Wysocki
2013-11-21 3:48 ` Zhang Rui
1 sibling, 1 reply; 4+ messages in thread
From: Toshi Kani @ 2013-11-20 22:38 UTC (permalink / raw)
To: HATAYAMA Daisuke; +Cc: lenb, rjw, linux-acpi, Linux Kernel Mailing List
On Tue, 2013-11-19 at 17:54 +0900, HATAYAMA Daisuke wrote:
> Currently, each of the ACPI tables exported from
> /sys/firmware/acpi/tables is of zero size:
>
> $ LANG=C ls -ld /sys/firmware/acpi/tables/*
> -r-------- 1 root root 0 Nov 19 09:48 /sys/firmware/acpi/tables/APIC
> -r-------- 1 root root 0 Nov 19 09:48 /sys/firmware/acpi/tables/BOOT
> -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/DSDT
> -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/FACP
> -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/FACS
> -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/MCFG
> -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/SRAT
> drwxr-xr-x 2 root root 0 Nov 19 09:48 /sys/firmware/acpi/tables/dynamic/
>
> due to which, user-land tools fail reading each table. For example:
>
> $ acpidump -f /sys/firmware/acpi/tables/SRAT
> Could not get input file size: /sys/firmware/acpi/tables/SRAT
>
> To deal with the issue, this patch assigns size of each ACPI table to
> the corresponding sysfs file.
>
> $ LANG=C ls -hld /sys/firmware/acpi/tables/*
> -r-------- 1 root root 94 Nov 19 16:45 /sys/firmware/acpi/tables/APIC
> -r-------- 1 root root 40 Nov 19 16:45 /sys/firmware/acpi/tables/BOOT
> -r-------- 1 root root 58K Nov 19 16:55 /sys/firmware/acpi/tables/DSDT
> -r-------- 1 root root 244 Nov 19 16:55 /sys/firmware/acpi/tables/FACP
> -r-------- 1 root root 64 Nov 19 16:55 /sys/firmware/acpi/tables/FACS
> -r-------- 1 root root 60 Nov 19 16:55 /sys/firmware/acpi/tables/MCFG
> -r-------- 1 root root 168 Nov 19 16:45 /sys/firmware/acpi/tables/SRAT
> drwxr-xr-x 2 root root 0 Nov 19 16:55 /sys/firmware/acpi/tables/dynamic/
>
> Then, user-land tools work well like:
>
> $ acpidump -f /sys/firmware/acpi/tables/SRAT
> SRAT @ 0x0000000000000000
> 0000: 53 52 41 54 A8 00 00 00 02 65 56 4D 57 41 52 45 SRAT.....eVMWARE
> 0010: 4D 45 4D 50 4C 55 47 20 00 00 04 06 56 4D 57 20 MEMPLUG ....VMW
> 0020: 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ................
> 0030: 01 28 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .(..............
> 0040: 00 00 0A 00 00 00 00 00 00 00 00 00 01 00 00 00 ................
> 0050: 00 00 00 00 00 00 00 00 01 28 00 00 00 00 00 00 .........(......
> 0060: 00 00 10 00 00 00 00 00 00 00 F0 BF 00 00 00 00 ................
> 0070: 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ................
> 0080: 01 28 00 00 00 00 00 00 00 00 00 00 01 00 00 00 .(..............
> 0090: 00 00 00 40 00 00 00 00 00 00 00 00 01 00 00 00 ...@............
> 00A0: 00 00 00 00 00 00 00 00 ........
>
> Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Acked-by: Toshi Kani <toshi.kani@hp.com>
Thanks,
-Toshi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sysfs, acpi, tables: Set file size for each ACPI table
2013-11-20 22:38 ` Toshi Kani
@ 2013-11-21 0:32 ` Rafael J. Wysocki
0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2013-11-21 0:32 UTC (permalink / raw)
To: Toshi Kani; +Cc: HATAYAMA Daisuke, lenb, linux-acpi, Linux Kernel Mailing List
On Wednesday, November 20, 2013 03:38:55 PM Toshi Kani wrote:
> On Tue, 2013-11-19 at 17:54 +0900, HATAYAMA Daisuke wrote:
> > Currently, each of the ACPI tables exported from
> > /sys/firmware/acpi/tables is of zero size:
> >
> > $ LANG=C ls -ld /sys/firmware/acpi/tables/*
> > -r-------- 1 root root 0 Nov 19 09:48 /sys/firmware/acpi/tables/APIC
> > -r-------- 1 root root 0 Nov 19 09:48 /sys/firmware/acpi/tables/BOOT
> > -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/DSDT
> > -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/FACP
> > -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/FACS
> > -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/MCFG
> > -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/SRAT
> > drwxr-xr-x 2 root root 0 Nov 19 09:48 /sys/firmware/acpi/tables/dynamic/
> >
> > due to which, user-land tools fail reading each table. For example:
> >
> > $ acpidump -f /sys/firmware/acpi/tables/SRAT
> > Could not get input file size: /sys/firmware/acpi/tables/SRAT
> >
> > To deal with the issue, this patch assigns size of each ACPI table to
> > the corresponding sysfs file.
> >
> > $ LANG=C ls -hld /sys/firmware/acpi/tables/*
> > -r-------- 1 root root 94 Nov 19 16:45 /sys/firmware/acpi/tables/APIC
> > -r-------- 1 root root 40 Nov 19 16:45 /sys/firmware/acpi/tables/BOOT
> > -r-------- 1 root root 58K Nov 19 16:55 /sys/firmware/acpi/tables/DSDT
> > -r-------- 1 root root 244 Nov 19 16:55 /sys/firmware/acpi/tables/FACP
> > -r-------- 1 root root 64 Nov 19 16:55 /sys/firmware/acpi/tables/FACS
> > -r-------- 1 root root 60 Nov 19 16:55 /sys/firmware/acpi/tables/MCFG
> > -r-------- 1 root root 168 Nov 19 16:45 /sys/firmware/acpi/tables/SRAT
> > drwxr-xr-x 2 root root 0 Nov 19 16:55 /sys/firmware/acpi/tables/dynamic/
> >
> > Then, user-land tools work well like:
> >
> > $ acpidump -f /sys/firmware/acpi/tables/SRAT
> > SRAT @ 0x0000000000000000
> > 0000: 53 52 41 54 A8 00 00 00 02 65 56 4D 57 41 52 45 SRAT.....eVMWARE
> > 0010: 4D 45 4D 50 4C 55 47 20 00 00 04 06 56 4D 57 20 MEMPLUG ....VMW
> > 0020: 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ................
> > 0030: 01 28 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .(..............
> > 0040: 00 00 0A 00 00 00 00 00 00 00 00 00 01 00 00 00 ................
> > 0050: 00 00 00 00 00 00 00 00 01 28 00 00 00 00 00 00 .........(......
> > 0060: 00 00 10 00 00 00 00 00 00 00 F0 BF 00 00 00 00 ................
> > 0070: 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ................
> > 0080: 01 28 00 00 00 00 00 00 00 00 00 00 01 00 00 00 .(..............
> > 0090: 00 00 00 40 00 00 00 00 00 00 00 00 01 00 00 00 ...@............
> > 00A0: 00 00 00 00 00 00 00 00 ........
> >
> > Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
>
> Acked-by: Toshi Kani <toshi.kani@hp.com>
Thanks!
I've queued up the patch for the next ACPI pull request.
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] sysfs, acpi, tables: Set file size for each ACPI table
2013-11-19 8:54 [PATCH] sysfs, acpi, tables: Set file size for each ACPI table HATAYAMA Daisuke
2013-11-20 22:38 ` Toshi Kani
@ 2013-11-21 3:48 ` Zhang Rui
1 sibling, 0 replies; 4+ messages in thread
From: Zhang Rui @ 2013-11-21 3:48 UTC (permalink / raw)
To: HATAYAMA Daisuke; +Cc: lenb, rjw, linux-acpi, Linux Kernel Mailing List
On 二, 2013-11-19 at 17:54 +0900, HATAYAMA Daisuke wrote:
> Currently, each of the ACPI tables exported from
> /sys/firmware/acpi/tables is of zero size:
>
> $ LANG=C ls -ld /sys/firmware/acpi/tables/*
> -r-------- 1 root root 0 Nov 19 09:48 /sys/firmware/acpi/tables/APIC
> -r-------- 1 root root 0 Nov 19 09:48 /sys/firmware/acpi/tables/BOOT
> -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/DSDT
> -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/FACP
> -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/FACS
> -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/MCFG
> -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/SRAT
> drwxr-xr-x 2 root root 0 Nov 19 09:48 /sys/firmware/acpi/tables/dynamic/
>
> due to which, user-land tools fail reading each table. For example:
>
> $ acpidump -f /sys/firmware/acpi/tables/SRAT
> Could not get input file size: /sys/firmware/acpi/tables/SRAT
>
> To deal with the issue, this patch assigns size of each ACPI table to
> the corresponding sysfs file.
>
> $ LANG=C ls -hld /sys/firmware/acpi/tables/*
> -r-------- 1 root root 94 Nov 19 16:45 /sys/firmware/acpi/tables/APIC
> -r-------- 1 root root 40 Nov 19 16:45 /sys/firmware/acpi/tables/BOOT
> -r-------- 1 root root 58K Nov 19 16:55 /sys/firmware/acpi/tables/DSDT
> -r-------- 1 root root 244 Nov 19 16:55 /sys/firmware/acpi/tables/FACP
> -r-------- 1 root root 64 Nov 19 16:55 /sys/firmware/acpi/tables/FACS
> -r-------- 1 root root 60 Nov 19 16:55 /sys/firmware/acpi/tables/MCFG
> -r-------- 1 root root 168 Nov 19 16:45 /sys/firmware/acpi/tables/SRAT
> drwxr-xr-x 2 root root 0 Nov 19 16:55 /sys/firmware/acpi/tables/dynamic/
>
> Then, user-land tools work well like:
>
> $ acpidump -f /sys/firmware/acpi/tables/SRAT
> SRAT @ 0x0000000000000000
> 0000: 53 52 41 54 A8 00 00 00 02 65 56 4D 57 41 52 45 SRAT.....eVMWARE
> 0010: 4D 45 4D 50 4C 55 47 20 00 00 04 06 56 4D 57 20 MEMPLUG ....VMW
> 0020: 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ................
> 0030: 01 28 00 00 00 00 00 00 00 00 00 00 00 00 00 00 .(..............
> 0040: 00 00 0A 00 00 00 00 00 00 00 00 00 01 00 00 00 ................
> 0050: 00 00 00 00 00 00 00 00 01 28 00 00 00 00 00 00 .........(......
> 0060: 00 00 10 00 00 00 00 00 00 00 F0 BF 00 00 00 00 ................
> 0070: 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 ................
> 0080: 01 28 00 00 00 00 00 00 00 00 00 00 01 00 00 00 .(..............
> 0090: 00 00 00 40 00 00 00 00 00 00 00 00 01 00 00 00 ...@............
> 00A0: 00 00 00 00 00 00 00 00 ........
>
> Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Nice catch!
Acked-by: Zhang Rui <rui.zhang@intel.com>
thanks,
rui
> ---
> drivers/acpi/sysfs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/sysfs.c b/drivers/acpi/sysfs.c
> index 05306a5..095ff1f 100644
> --- a/drivers/acpi/sysfs.c
> +++ b/drivers/acpi/sysfs.c
> @@ -309,7 +309,7 @@ static void acpi_table_attr_init(struct acpi_table_attr *table_attr,
> sprintf(table_attr->name + ACPI_NAME_SIZE, "%d",
> table_attr->instance);
>
> - table_attr->attr.size = 0;
> + table_attr->attr.size = table_header->length;
> table_attr->attr.read = acpi_table_show;
> table_attr->attr.attr.name = table_attr->name;
> table_attr->attr.attr.mode = 0400;
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-11-21 3:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-19 8:54 [PATCH] sysfs, acpi, tables: Set file size for each ACPI table HATAYAMA Daisuke
2013-11-20 22:38 ` Toshi Kani
2013-11-21 0:32 ` Rafael J. Wysocki
2013-11-21 3:48 ` Zhang Rui
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox