linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] x86/platform/uv: Move UV procfs leaves to sysfs
@ 2020-11-25 17:29 Mike Travis
  2020-11-25 17:29 ` [PATCH 1/5] x86/platform/uv: Add kernel interfaces for obtaining system info Mike Travis
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Mike Travis @ 2020-11-25 17:29 UTC (permalink / raw)
  To: Hans de Goede, Justin Ernst, Mark Gross, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, Steve Wahl
  Cc: Mike Travis, Dimitri Sivanich, Russ Anderson, H. Peter Anvin,
	Mauro Carvalho Chehab, Suzuki K Poulose, Ilya Dryomov,
	linux-kernel, platform-driver-x86


Duplicate the current UV procfs leaves to the uv_sysfs driver so they show
up under /sys/firmware/sgi_uv.  Show a 'deprecated' warning message if
any of the old /proc/sgi_uv leaves are used.

These patches depend on the prior set sent by Justin Ernst <justin.ernst@hpe.com>
	x86/platform/uv: Remove existing /sys/firmware/sgi_uv/ interface
	x86/platform/uv: Add and export uv_bios_* functions
	x86/platform/uv: Add new uv_sysfs platform driver
	x86/platform/uv: Update ABI documentation of /sys/firmware/sgi_uv/
	x86/platform/uv: Update MAINTAINERS for uv_sysfs driver

Mike Travis (5):
  x86/platform/uv: Add kernel interfaces for obtaining system info.
  x86/platform/uv: Add sysfs leaves to replace those in procfs
  x86/platform/uv: Add sysfs hubless leaves
  x86/platform/uv: Add deprecated messages to /proc info leaves
  x86/platform/uv: Update sysfs document file

 .../ABI/testing/sysfs-firmware-sgi_uv         | 16 +++++
 arch/x86/include/asm/uv/bios.h                |  2 +
 arch/x86/kernel/apic/x2apic_uv_x.c            | 38 +++++++++-
 drivers/platform/x86/uv_sysfs.c               | 70 ++++++++++++++++++-
 4 files changed, 123 insertions(+), 3 deletions(-)

-- 
2.21.0


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/5] x86/platform/uv: Add kernel interfaces for obtaining system info.
  2020-11-25 17:29 [PATCH 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Mike Travis
@ 2020-11-25 17:29 ` Mike Travis
  2020-11-25 17:29 ` [PATCH 2/5] x86/platform/uv: Add sysfs leaves to replace those in procfs Mike Travis
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Mike Travis @ 2020-11-25 17:29 UTC (permalink / raw)
  To: Hans de Goede, Justin Ernst, Mark Gross, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, Steve Wahl
  Cc: Mike Travis, Dimitri Sivanich, Russ Anderson, H. Peter Anvin,
	Mauro Carvalho Chehab, Suzuki K Poulose, Ilya Dryomov,
	linux-kernel, platform-driver-x86

Add kernel interfaces used to obtain info for the uv_sysfs driver
to display.

Signed-off-by: Mike Travis <mike.travis@hpe.com>
Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
---
 arch/x86/include/asm/uv/bios.h     |  2 ++
 arch/x86/kernel/apic/x2apic_uv_x.c | 12 ++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/arch/x86/include/asm/uv/bios.h b/arch/x86/include/asm/uv/bios.h
index 01ba080887b3..1b6455f881f9 100644
--- a/arch/x86/include/asm/uv/bios.h
+++ b/arch/x86/include/asm/uv/bios.h
@@ -200,6 +200,8 @@ extern long sn_partition_id;
 extern long sn_coherency_id;
 extern long sn_region_size;
 extern long system_serial_number;
+extern ssize_t uv_get_archtype(char *buf, int len);
+extern int uv_get_hubless_system(void);
 
 extern struct kobject *sgi_uv_kobj;	/* /sys/firmware/sgi_uv */
 
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 1b98f8c12b96..48746031b39a 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -502,6 +502,18 @@ enum uv_system_type get_uv_system_type(void)
 	return uv_system_type;
 }
 
+int uv_get_hubless_system(void)
+{
+	return uv_hubless_system;
+}
+EXPORT_SYMBOL_GPL(uv_get_hubless_system);
+
+ssize_t uv_get_archtype(char *buf, int len)
+{
+	return scnprintf(buf, len, "%s/%s", uv_archtype, oem_table_id);
+}
+EXPORT_SYMBOL_GPL(uv_get_archtype);
+
 int is_uv_system(void)
 {
 	return uv_system_type != UV_NONE;
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/5] x86/platform/uv: Add sysfs leaves to replace those in procfs
  2020-11-25 17:29 [PATCH 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Mike Travis
  2020-11-25 17:29 ` [PATCH 1/5] x86/platform/uv: Add kernel interfaces for obtaining system info Mike Travis
@ 2020-11-25 17:29 ` Mike Travis
  2020-11-25 17:29 ` [PATCH 3/5] x86/platform/uv: Add sysfs hubless leaves Mike Travis
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Mike Travis @ 2020-11-25 17:29 UTC (permalink / raw)
  To: Hans de Goede, Justin Ernst, Mark Gross, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, Steve Wahl
  Cc: Mike Travis, Dimitri Sivanich, Russ Anderson, H. Peter Anvin,
	Mauro Carvalho Chehab, Suzuki K Poulose, Ilya Dryomov,
	linux-kernel, platform-driver-x86

Add uv_sysfs leaves to display the info.

Signed-off-by: Mike Travis <mike.travis@hpe.com>
Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
---
 drivers/platform/x86/uv_sysfs.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/platform/x86/uv_sysfs.c b/drivers/platform/x86/uv_sysfs.c
index 6de360370f0e..6729ea8b63d2 100644
--- a/drivers/platform/x86/uv_sysfs.c
+++ b/drivers/platform/x86/uv_sysfs.c
@@ -729,14 +729,32 @@ static ssize_t uv_type_show(struct kobject *kobj,
 	return scnprintf(buf, PAGE_SIZE, "%s\n", uv_type_string());
 }
 
+static ssize_t uv_archtype_show(struct kobject *kobj,
+			struct kobj_attribute *attr, char *buf)
+{
+	return uv_get_archtype(buf, PAGE_SIZE);
+}
+
+static ssize_t uv_hub_type_show(struct kobject *kobj,
+			struct kobj_attribute *attr, char *buf)
+{
+	return scnprintf(buf, PAGE_SIZE, "0x%x\n", uv_hub_type());
+}
+
 static struct kobj_attribute partition_id_attr =
 	__ATTR(partition_id, 0444, partition_id_show, NULL);
 static struct kobj_attribute uv_type_attr =
 	__ATTR(uv_type, 0444, uv_type_show, NULL);
+static struct kobj_attribute uv_archtype_attr =
+	__ATTR(archtype, 0444, uv_archtype_show, NULL);
+static struct kobj_attribute uv_hub_type_attr =
+	__ATTR(hub_type, 0444, uv_hub_type_show, NULL);
 
 static struct attribute *base_attrs[] = {
 	&partition_id_attr.attr,
 	&uv_type_attr.attr,
+	&uv_archtype_attr.attr,
+	&uv_hub_type_attr.attr,
 	NULL,
 };
 
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/5] x86/platform/uv: Add sysfs hubless leaves
  2020-11-25 17:29 [PATCH 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Mike Travis
  2020-11-25 17:29 ` [PATCH 1/5] x86/platform/uv: Add kernel interfaces for obtaining system info Mike Travis
  2020-11-25 17:29 ` [PATCH 2/5] x86/platform/uv: Add sysfs leaves to replace those in procfs Mike Travis
@ 2020-11-25 17:29 ` Mike Travis
  2020-11-25 17:29 ` [PATCH 4/5] x86/platform/uv: Add deprecated messages to /proc info leaves Mike Travis
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Mike Travis @ 2020-11-25 17:29 UTC (permalink / raw)
  To: Hans de Goede, Justin Ernst, Mark Gross, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, Steve Wahl
  Cc: Mike Travis, Dimitri Sivanich, Russ Anderson, H. Peter Anvin,
	Mauro Carvalho Chehab, Suzuki K Poulose, Ilya Dryomov,
	linux-kernel, platform-driver-x86

Add uv_sysfs hubless leaves for UV hubless systems.

Signed-off-by: Mike Travis <mike.travis@hpe.com>
Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
---
 drivers/platform/x86/uv_sysfs.c | 52 +++++++++++++++++++++++++++++++--
 1 file changed, 50 insertions(+), 2 deletions(-)

diff --git a/drivers/platform/x86/uv_sysfs.c b/drivers/platform/x86/uv_sysfs.c
index 6729ea8b63d2..5aa1addf3598 100644
--- a/drivers/platform/x86/uv_sysfs.c
+++ b/drivers/platform/x86/uv_sysfs.c
@@ -44,6 +44,8 @@ static const char *uv_type_string(void)
 		return "5.0";
 	else if (is_uv2_hub())
 		return "3.0";
+	else if (uv_get_hubless_system())
+		return "0.1";
 	else
 		return "unknown";
 }
@@ -741,6 +743,12 @@ static ssize_t uv_hub_type_show(struct kobject *kobj,
 	return scnprintf(buf, PAGE_SIZE, "0x%x\n", uv_hub_type());
 }
 
+static ssize_t uv_hubless_show(struct kobject *kobj,
+			struct kobj_attribute *attr, char *buf)
+{
+	return scnprintf(buf, PAGE_SIZE, "0x%x\n", uv_get_hubless_system());
+}
+
 static struct kobj_attribute partition_id_attr =
 	__ATTR(partition_id, 0444, partition_id_show, NULL);
 static struct kobj_attribute uv_type_attr =
@@ -749,6 +757,8 @@ static struct kobj_attribute uv_archtype_attr =
 	__ATTR(archtype, 0444, uv_archtype_show, NULL);
 static struct kobj_attribute uv_hub_type_attr =
 	__ATTR(hub_type, 0444, uv_hub_type_show, NULL);
+static struct kobj_attribute uv_hubless_attr =
+	__ATTR(hubless, 0444, uv_hubless_show, NULL);
 
 static struct attribute *base_attrs[] = {
 	&partition_id_attr.attr,
@@ -795,11 +805,36 @@ static int initial_bios_setup(void)
 	return 0;
 }
 
+static struct attribute *hubless_base_attrs[] = {
+	&partition_id_attr.attr,
+	&uv_type_attr.attr,
+	&uv_archtype_attr.attr,
+	&uv_hubless_attr.attr,
+	NULL,
+};
+
+static struct attribute_group hubless_base_attr_group = {
+	.attrs = hubless_base_attrs
+};
+
+
+static int __init uv_sysfs_hubless_init(void)
+{
+	int ret;
+
+	ret = sysfs_create_group(sgi_uv_kobj, &hubless_base_attr_group);
+	if (ret) {
+		pr_warn("sysfs_create_group hubless_base_attr_group failed\n");
+		kobject_put(sgi_uv_kobj);
+	}
+	return ret;
+}
+
 static int __init uv_sysfs_init(void)
 {
 	int ret = 0;
 
-	if (!is_uv_system())
+	if (!is_uv_system() && !uv_get_hubless_system())
 		return -ENODEV;
 
 	num_cnodes = uv_num_possible_blades();
@@ -810,6 +845,10 @@ static int __init uv_sysfs_init(void)
 		pr_warn("kobject_create_and_add sgi_uv failed\n");
 		return -EINVAL;
 	}
+
+	if (uv_get_hubless_system())
+		return uv_sysfs_hubless_init();
+
 	ret = sysfs_create_group(sgi_uv_kobj, &base_attr_group);
 	if (ret) {
 		pr_warn("sysfs_create_group base_attr_group failed\n");
@@ -847,10 +886,19 @@ static int __init uv_sysfs_init(void)
 	return ret;
 }
 
+static void __exit uv_sysfs_hubless_exit(void)
+{
+	sysfs_remove_group(sgi_uv_kobj, &hubless_base_attr_group);
+	kobject_put(sgi_uv_kobj);
+}
+
 static void __exit uv_sysfs_exit(void)
 {
-	if (!is_uv_system())
+	if (!is_uv_system()) {
+		if (uv_get_hubless_system())
+			uv_sysfs_hubless_exit();
 		return;
+	}
 
 	pci_topology_exit();
 	uv_ports_exit();
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/5] x86/platform/uv: Add deprecated messages to /proc info leaves
  2020-11-25 17:29 [PATCH 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Mike Travis
                   ` (2 preceding siblings ...)
  2020-11-25 17:29 ` [PATCH 3/5] x86/platform/uv: Add sysfs hubless leaves Mike Travis
@ 2020-11-25 17:29 ` Mike Travis
  2020-11-26 10:45   ` Hans de Goede
  2020-11-25 17:29 ` [PATCH 5/5] x86/platform/uv: Update sysfs document file Mike Travis
  2020-11-26 10:44 ` [PATCH 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Hans de Goede
  5 siblings, 1 reply; 11+ messages in thread
From: Mike Travis @ 2020-11-25 17:29 UTC (permalink / raw)
  To: Hans de Goede, Justin Ernst, Mark Gross, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, Steve Wahl
  Cc: Mike Travis, Dimitri Sivanich, Russ Anderson, H. Peter Anvin,
	Mauro Carvalho Chehab, Suzuki K Poulose, Ilya Dryomov,
	linux-kernel, platform-driver-x86

Add "deprecated" message to any access to old /proc/sgi_uv/* leaves.

Signed-off-by: Mike Travis <mike.travis@hpe.com>
Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
---
 arch/x86/kernel/apic/x2apic_uv_x.c | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 48746031b39a..bfd77a00c2a1 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -1615,21 +1615,45 @@ static void check_efi_reboot(void)
 		reboot_type = BOOT_ACPI;
 }
 
-/* Setup user proc fs files */
+/*
+ * User proc fs file handling now deprecated.
+ * Recommend using /sys/firmware/sgi_uv/... instead.
+ */
+static void proc_print_msg(int *flag, char *what, char *which)
+{
+	if (*flag)
+		return;
+
+	pr_notice(
+		"%s: using deprecated /proc/sgi_uv/%s, use /sys/firmware/sgi_uv/%s\n",
+		current->comm, what, which ? which : what);
+
+	*flag = 1;
+}
+
 static int __maybe_unused proc_hubbed_show(struct seq_file *file, void *data)
 {
+	static int flag;
+
+	proc_print_msg(&flag, "hubbed", "hub_type");
 	seq_printf(file, "0x%x\n", uv_hubbed_system);
 	return 0;
 }
 
 static int __maybe_unused proc_hubless_show(struct seq_file *file, void *data)
 {
+	static int flag;
+
+	proc_print_msg(&flag, "hubless", NULL);
 	seq_printf(file, "0x%x\n", uv_hubless_system);
 	return 0;
 }
 
 static int __maybe_unused proc_archtype_show(struct seq_file *file, void *data)
 {
+	static int flag;
+
+	proc_print_msg(&flag, "archtype", NULL);
 	seq_printf(file, "%s/%s\n", uv_archtype, oem_table_id);
 	return 0;
 }
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/5] x86/platform/uv: Update sysfs document file
  2020-11-25 17:29 [PATCH 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Mike Travis
                   ` (3 preceding siblings ...)
  2020-11-25 17:29 ` [PATCH 4/5] x86/platform/uv: Add deprecated messages to /proc info leaves Mike Travis
@ 2020-11-25 17:29 ` Mike Travis
  2020-11-26 10:44 ` [PATCH 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Hans de Goede
  5 siblings, 0 replies; 11+ messages in thread
From: Mike Travis @ 2020-11-25 17:29 UTC (permalink / raw)
  To: Hans de Goede, Justin Ernst, Mark Gross, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, Steve Wahl
  Cc: Mike Travis, Dimitri Sivanich, Russ Anderson, H. Peter Anvin,
	Mauro Carvalho Chehab, Suzuki K Poulose, Ilya Dryomov,
	linux-kernel, platform-driver-x86

Update sysfs Document file to include moved /proc leaves.

Signed-off-by: Mike Travis <mike.travis@hpe.com>
---
 Documentation/ABI/testing/sysfs-firmware-sgi_uv | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/Documentation/ABI/testing/sysfs-firmware-sgi_uv b/Documentation/ABI/testing/sysfs-firmware-sgi_uv
index ca5cdccdb1a8..fa7f7aefa5ed 100644
--- a/Documentation/ABI/testing/sysfs-firmware-sgi_uv
+++ b/Documentation/ABI/testing/sysfs-firmware-sgi_uv
@@ -7,9 +7,24 @@ Description:
 
 		Under that directory are a number of read-only attributes:
 
+			archtype
+			hub_type
+			hubless
 			partition_id
 			uv_type
 
+		The archtype entry contains the UV architecture type that
+		is used to select arch-dependent addresses and features.
+		If can be set via the OEM_ID in the ACPI MADT table or by
+		UVsystab entry both passed from UV BIOS.
+
+		The hub_type entry is used to select the type of hub which is
+		similar to uv_type but encoded in a binary format.  Include
+		the file uv_hub.h to get the definitions.
+
+		The hubless entry basically is present and set only if there
+		is no hub.  In this case the hub_type entry is not present.
+
 		The partition_id entry contains the partition id.
 		UV systems can be partitioned into multiple physical
 		machines, which each partition running a unique copy
@@ -18,6 +33,7 @@ Description:
 
 		The uv_type entry contains the hub revision number.
 		This value can be used to identify the UV system version:
+			"0.*" = Hubless UV ('*' is subtype)
 			"3.0" = UV2
 			"5.0" = UV3
 			"7.0" = UV4
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/5] x86/platform/uv: Move UV procfs leaves to sysfs
  2020-11-25 17:29 [PATCH 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Mike Travis
                   ` (4 preceding siblings ...)
  2020-11-25 17:29 ` [PATCH 5/5] x86/platform/uv: Update sysfs document file Mike Travis
@ 2020-11-26 10:44 ` Hans de Goede
  2020-11-27 14:41   ` Mike Travis
  5 siblings, 1 reply; 11+ messages in thread
From: Hans de Goede @ 2020-11-26 10:44 UTC (permalink / raw)
  To: Mike Travis, Justin Ernst, Mark Gross, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, Steve Wahl
  Cc: Dimitri Sivanich, Russ Anderson, H. Peter Anvin,
	Mauro Carvalho Chehab, Suzuki K Poulose, Ilya Dryomov,
	linux-kernel, platform-driver-x86

Hi,

On 11/25/20 6:29 PM, Mike Travis wrote:
> 
> Duplicate the current UV procfs leaves to the uv_sysfs driver so they show
> up under /sys/firmware/sgi_uv.  Show a 'deprecated' warning message if
> any of the old /proc/sgi_uv leaves are used.
> 
> These patches depend on the prior set sent by Justin Ernst <justin.ernst@hpe.com>
> 	x86/platform/uv: Remove existing /sys/firmware/sgi_uv/ interface
> 	x86/platform/uv: Add and export uv_bios_* functions
> 	x86/platform/uv: Add new uv_sysfs platform driver
> 	x86/platform/uv: Update ABI documentation of /sys/firmware/sgi_uv/
> 	x86/platform/uv: Update MAINTAINERS for uv_sysfs driver
> 
> Mike Travis (5):
>   x86/platform/uv: Add kernel interfaces for obtaining system info.
>   x86/platform/uv: Add sysfs leaves to replace those in procfs
>   x86/platform/uv: Add sysfs hubless leaves
>   x86/platform/uv: Add deprecated messages to /proc info leaves
>   x86/platform/uv: Update sysfs document file
> 
>  .../ABI/testing/sysfs-firmware-sgi_uv         | 16 +++++
>  arch/x86/include/asm/uv/bios.h                |  2 +
>  arch/x86/kernel/apic/x2apic_uv_x.c            | 38 +++++++++-
>  drivers/platform/x86/uv_sysfs.c               | 70 ++++++++++++++++++-
>  4 files changed, 123 insertions(+), 3 deletions(-)

This series depends on the:

[PATCH v3 0/5] x86/platform/uv: Add uv_sysfs platform driver

Series, next time when such a thing is the case, please add a note
about this to the cover letter.

Like with the "[PATCH v3 0/5] x86/platform/uv: Add uv_sysfs platform driver" series,
this series too should be merged in its entirety through the x86/tip tree (once the
other series is merged). Please also add this info to the cover letter.

I've one remark to patch 4 (which I send in a reply to that). So a v2 is going
to be necessary. Please include the above bits in the v2 cover-letter.

Regards,

Hans


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/5] x86/platform/uv: Add deprecated messages to /proc info leaves
  2020-11-25 17:29 ` [PATCH 4/5] x86/platform/uv: Add deprecated messages to /proc info leaves Mike Travis
@ 2020-11-26 10:45   ` Hans de Goede
  2020-11-27 14:58     ` Mike Travis
  0 siblings, 1 reply; 11+ messages in thread
From: Hans de Goede @ 2020-11-26 10:45 UTC (permalink / raw)
  To: Mike Travis, Justin Ernst, Mark Gross, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, Steve Wahl
  Cc: Dimitri Sivanich, Russ Anderson, H. Peter Anvin,
	Mauro Carvalho Chehab, Suzuki K Poulose, Ilya Dryomov,
	linux-kernel, platform-driver-x86

Hi,

On 11/25/20 6:29 PM, Mike Travis wrote:
> Add "deprecated" message to any access to old /proc/sgi_uv/* leaves.
> 
> Signed-off-by: Mike Travis <mike.travis@hpe.com>
> Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
> ---
>  arch/x86/kernel/apic/x2apic_uv_x.c | 26 +++++++++++++++++++++++++-
>  1 file changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
> index 48746031b39a..bfd77a00c2a1 100644
> --- a/arch/x86/kernel/apic/x2apic_uv_x.c
> +++ b/arch/x86/kernel/apic/x2apic_uv_x.c
> @@ -1615,21 +1615,45 @@ static void check_efi_reboot(void)
>  		reboot_type = BOOT_ACPI;
>  }
>  
> -/* Setup user proc fs files */
> +/*
> + * User proc fs file handling now deprecated.
> + * Recommend using /sys/firmware/sgi_uv/... instead.
> + */
> +static void proc_print_msg(int *flag, char *what, char *which)
> +{
> +	if (*flag)
> +		return;
> +
> +	pr_notice(
> +		"%s: using deprecated /proc/sgi_uv/%s, use /sys/firmware/sgi_uv/%s\n",
> +		current->comm, what, which ? which : what);
> +
> +	*flag = 1;
> +}
> +

You have just re-invented pr_notice_once, please just use pr_notice_once
directly in the _show functions.

Regards,

Hans




>  static int __maybe_unused proc_hubbed_show(struct seq_file *file, void *data)
>  {
> +	static int flag;
> +
> +	proc_print_msg(&flag, "hubbed", "hub_type");
>  	seq_printf(file, "0x%x\n", uv_hubbed_system);
>  	return 0;
>  }
>  
>  static int __maybe_unused proc_hubless_show(struct seq_file *file, void *data)
>  {
> +	static int flag;
> +
> +	proc_print_msg(&flag, "hubless", NULL);
>  	seq_printf(file, "0x%x\n", uv_hubless_system);
>  	return 0;
>  }
>  
>  static int __maybe_unused proc_archtype_show(struct seq_file *file, void *data)
>  {
> +	static int flag;
> +
> +	proc_print_msg(&flag, "archtype", NULL);
>  	seq_printf(file, "%s/%s\n", uv_archtype, oem_table_id);
>  	return 0;
>  }
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 0/5] x86/platform/uv: Move UV procfs leaves to sysfs
  2020-11-26 10:44 ` [PATCH 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Hans de Goede
@ 2020-11-27 14:41   ` Mike Travis
  0 siblings, 0 replies; 11+ messages in thread
From: Mike Travis @ 2020-11-27 14:41 UTC (permalink / raw)
  To: Hans de Goede, Justin Ernst, Mark Gross, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, Steve Wahl
  Cc: Dimitri Sivanich, Russ Anderson, H. Peter Anvin,
	Mauro Carvalho Chehab, Suzuki K Poulose, Ilya Dryomov,
	linux-kernel, platform-driver-x86



On 11/26/2020 2:44 AM, Hans de Goede wrote:
> Hi,
> 
> On 11/25/20 6:29 PM, Mike Travis wrote:
>>
>> Duplicate the current UV procfs leaves to the uv_sysfs driver so they show
>> up under /sys/firmware/sgi_uv.  Show a 'deprecated' warning message if
>> any of the old /proc/sgi_uv leaves are used.
>>
>> These patches depend on the prior set sent by Justin Ernst <justin.ernst@hpe.com>
>> 	x86/platform/uv: Remove existing /sys/firmware/sgi_uv/ interface
>> 	x86/platform/uv: Add and export uv_bios_* functions
>> 	x86/platform/uv: Add new uv_sysfs platform driver
>> 	x86/platform/uv: Update ABI documentation of /sys/firmware/sgi_uv/
>> 	x86/platform/uv: Update MAINTAINERS for uv_sysfs driver
>>
>> Mike Travis (5):
>>    x86/platform/uv: Add kernel interfaces for obtaining system info.
>>    x86/platform/uv: Add sysfs leaves to replace those in procfs
>>    x86/platform/uv: Add sysfs hubless leaves
>>    x86/platform/uv: Add deprecated messages to /proc info leaves
>>    x86/platform/uv: Update sysfs document file
>>
>>   .../ABI/testing/sysfs-firmware-sgi_uv         | 16 +++++
>>   arch/x86/include/asm/uv/bios.h                |  2 +
>>   arch/x86/kernel/apic/x2apic_uv_x.c            | 38 +++++++++-
>>   drivers/platform/x86/uv_sysfs.c               | 70 ++++++++++++++++++-
>>   4 files changed, 123 insertions(+), 3 deletions(-)
> 
> This series depends on the:
> 
> [PATCH v3 0/5] x86/platform/uv: Add uv_sysfs platform driver
> 
> Series, next time when such a thing is the case, please add a note
> about this to the cover letter.
> 
> Like with the "[PATCH v3 0/5] x86/platform/uv: Add uv_sysfs platform driver" series,
> this series too should be merged in its entirety through the x86/tip tree (once the
> other series is merged). Please also add this info to the cover letter.
> 
> I've one remark to patch 4 (which I send in a reply to that). So a v2 is going
> to be necessary. Please include the above bits in the v2 cover-letter.

I was just about to send a notice that Justin changed the underlying 
patch that these depend on.  (I was gone late Wednesday and all day 
yesterday).  That will be done later today, thanks!

> 
> Regards,
> 
> Hans
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/5] x86/platform/uv: Add deprecated messages to /proc info leaves
  2020-11-26 10:45   ` Hans de Goede
@ 2020-11-27 14:58     ` Mike Travis
  2020-11-27 18:06       ` Hans de Goede
  0 siblings, 1 reply; 11+ messages in thread
From: Mike Travis @ 2020-11-27 14:58 UTC (permalink / raw)
  To: Hans de Goede, Justin Ernst, Mark Gross, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, Steve Wahl
  Cc: Dimitri Sivanich, Russ Anderson, H. Peter Anvin,
	Mauro Carvalho Chehab, Suzuki K Poulose, Ilya Dryomov,
	linux-kernel, platform-driver-x86



On 11/26/2020 2:45 AM, Hans de Goede wrote:
> Hi,
> 
> On 11/25/20 6:29 PM, Mike Travis wrote:
>> Add "deprecated" message to any access to old /proc/sgi_uv/* leaves.
>>
>> Signed-off-by: Mike Travis <mike.travis@hpe.com>
>> Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
>> ---
>>   arch/x86/kernel/apic/x2apic_uv_x.c | 26 +++++++++++++++++++++++++-
>>   1 file changed, 25 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
>> index 48746031b39a..bfd77a00c2a1 100644
>> --- a/arch/x86/kernel/apic/x2apic_uv_x.c
>> +++ b/arch/x86/kernel/apic/x2apic_uv_x.c
>> @@ -1615,21 +1615,45 @@ static void check_efi_reboot(void)
>>   		reboot_type = BOOT_ACPI;
>>   }
>>   
>> -/* Setup user proc fs files */
>> +/*
>> + * User proc fs file handling now deprecated.
>> + * Recommend using /sys/firmware/sgi_uv/... instead.
>> + */
>> +static void proc_print_msg(int *flag, char *what, char *which)
>> +{
>> +	if (*flag)
>> +		return;
>> +
>> +	pr_notice(
>> +		"%s: using deprecated /proc/sgi_uv/%s, use /sys/firmware/sgi_uv/%s\n",
>> +		current->comm, what, which ? which : what);
>> +
>> +	*flag = 1;
>> +}
>> +
> 
> You have just re-invented pr_notice_once, please just use pr_notice_once
> directly in the _show functions.

I tried it both ways (actually with rate limiting as well).  The problem 
with using a static check in the error print function it will only print 
the first instance it encounters, not all of the references.

If I move it to the final output I need to replicate the verbiage of the 
format for every instance as you can't seem to combine the KERN_* level 
of printing and the pr_fmt reference of the format string.  I tried a 
few ways including just putting everything into a format character list. 
  But what used to work (indirect format pointer) doesn't any more.  Or 
I didn't hit on the correct combination of KERN_* level and indirect 
format string.

The last combination was no print limiting which caused of course the 
error message to be output on every occurrence.  (NASA has 35,000 
customers for their big systems, that's a lot of potential console 
messages.)  This really annoys them and we would get calls from those 
that don't have any means of changing this so they ask us.

So I just chose this method of accomplishing all goals, except of course 
using the higher level of print function (pr_notice_once).  But if you 
think method two ("use pr_notice_once directly in the _show function") 
is most favorable I will switch to that.  Thanks.

> 
> Regards,
> 
> Hans
> 
> 
> 
> 
>>   static int __maybe_unused proc_hubbed_show(struct seq_file *file, void *data)
>>   {
>> +	static int flag;
>> +
>> +	proc_print_msg(&flag, "hubbed", "hub_type");
>>   	seq_printf(file, "0x%x\n", uv_hubbed_system);
>>   	return 0;
>>   }
>>   
>>   static int __maybe_unused proc_hubless_show(struct seq_file *file, void *data)
>>   {
>> +	static int flag;
>> +
>> +	proc_print_msg(&flag, "hubless", NULL);
>>   	seq_printf(file, "0x%x\n", uv_hubless_system);
>>   	return 0;
>>   }
>>   
>>   static int __maybe_unused proc_archtype_show(struct seq_file *file, void *data)
>>   {
>> +	static int flag;
>> +
>> +	proc_print_msg(&flag, "archtype", NULL);
>>   	seq_printf(file, "%s/%s\n", uv_archtype, oem_table_id);
>>   	return 0;
>>   }
>>
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/5] x86/platform/uv: Add deprecated messages to /proc info leaves
  2020-11-27 14:58     ` Mike Travis
@ 2020-11-27 18:06       ` Hans de Goede
  0 siblings, 0 replies; 11+ messages in thread
From: Hans de Goede @ 2020-11-27 18:06 UTC (permalink / raw)
  To: Mike Travis, Justin Ernst, Mark Gross, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, Steve Wahl
  Cc: Dimitri Sivanich, Russ Anderson, H. Peter Anvin,
	Mauro Carvalho Chehab, Suzuki K Poulose, Ilya Dryomov,
	linux-kernel, platform-driver-x86

Hi,

On 11/27/20 3:58 PM, Mike Travis wrote:
> 
> 
> On 11/26/2020 2:45 AM, Hans de Goede wrote:
>> Hi,
>>
>> On 11/25/20 6:29 PM, Mike Travis wrote:
>>> Add "deprecated" message to any access to old /proc/sgi_uv/* leaves.
>>>
>>> Signed-off-by: Mike Travis <mike.travis@hpe.com>
>>> Reviewed-by: Steve Wahl <steve.wahl@hpe.com>
>>> ---
>>>   arch/x86/kernel/apic/x2apic_uv_x.c | 26 +++++++++++++++++++++++++-
>>>   1 file changed, 25 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
>>> index 48746031b39a..bfd77a00c2a1 100644
>>> --- a/arch/x86/kernel/apic/x2apic_uv_x.c
>>> +++ b/arch/x86/kernel/apic/x2apic_uv_x.c
>>> @@ -1615,21 +1615,45 @@ static void check_efi_reboot(void)
>>>           reboot_type = BOOT_ACPI;
>>>   }
>>>   -/* Setup user proc fs files */
>>> +/*
>>> + * User proc fs file handling now deprecated.
>>> + * Recommend using /sys/firmware/sgi_uv/... instead.
>>> + */
>>> +static void proc_print_msg(int *flag, char *what, char *which)
>>> +{
>>> +    if (*flag)
>>> +        return;
>>> +
>>> +    pr_notice(
>>> +        "%s: using deprecated /proc/sgi_uv/%s, use /sys/firmware/sgi_uv/%s\n",
>>> +        current->comm, what, which ? which : what);
>>> +
>>> +    *flag = 1;
>>> +}
>>> +
>>
>> You have just re-invented pr_notice_once, please just use pr_notice_once
>> directly in the _show functions.
> 
> I tried it both ways (actually with rate limiting as well).  The problem with using a static check in the error print function it will only print the first instance it encounters, not all of the references.
> 
> If I move it to the final output I need to replicate the verbiage of the format for every instance as you can't seem to combine the KERN_* level of printing and the pr_fmt reference of the format string.  I tried a few ways including just putting everything into a format character list.  But what used to work (indirect format pointer) doesn't any more.  Or I didn't hit on the correct combination of KERN_* level and indirect format string.
> 
> The last combination was no print limiting which caused of course the error message to be output on every occurrence.  (NASA has 35,000 customers for their big systems, that's a lot of potential console messages.)  This really annoys them and we would get calls from those that don't have any means of changing this so they ask us.
> 
> So I just chose this method of accomplishing all goals, except of course using the higher level of print function (pr_notice_once).  But if you think method two ("use pr_notice_once directly in the _show function") is most favorable I will switch to that.

Yeah I think using that is much better then reinventing it, you can simply just write
out the 3 different messages which you are "formatting" now as static strings so you get:

	pr_notice_once("%s: using deprecated /proc/sgi_uv/hubbed, use /sys/firmware/sgi_uv/hub_type\n", current->comm);

	pr_notice_once("%s: using deprecated /proc/sgi_uv/hubless, use /sys/firmware/sgi_uv/hubless\n", current->comm);

	pr_notice_once("%s: using deprecated /proc/sgi_uv/archtype, use /sys/firmware/sgi_uv/archtype\n", current->comm);

Regards,

Hans




> 
>>
>> Regards,
>>
>> Hans
>>
>>
>>
>>
>>>   static int __maybe_unused proc_hubbed_show(struct seq_file *file, void *data)
>>>   {
>>> +    static int flag;
>>> +
>>> +    proc_print_msg(&flag, "hubbed", "hub_type");
>>>       seq_printf(file, "0x%x\n", uv_hubbed_system);
>>>       return 0;
>>>   }
>>>     static int __maybe_unused proc_hubless_show(struct seq_file *file, void *data)
>>>   {
>>> +    static int flag;
>>> +
>>> +    proc_print_msg(&flag, "hubless", NULL);
>>>       seq_printf(file, "0x%x\n", uv_hubless_system);
>>>       return 0;
>>>   }
>>>     static int __maybe_unused proc_archtype_show(struct seq_file *file, void *data)
>>>   {
>>> +    static int flag;
>>> +
>>> +    proc_print_msg(&flag, "archtype", NULL);
>>>       seq_printf(file, "%s/%s\n", uv_archtype, oem_table_id);
>>>       return 0;
>>>   }
>>>
>>
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-11-27 18:06 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-25 17:29 [PATCH 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Mike Travis
2020-11-25 17:29 ` [PATCH 1/5] x86/platform/uv: Add kernel interfaces for obtaining system info Mike Travis
2020-11-25 17:29 ` [PATCH 2/5] x86/platform/uv: Add sysfs leaves to replace those in procfs Mike Travis
2020-11-25 17:29 ` [PATCH 3/5] x86/platform/uv: Add sysfs hubless leaves Mike Travis
2020-11-25 17:29 ` [PATCH 4/5] x86/platform/uv: Add deprecated messages to /proc info leaves Mike Travis
2020-11-26 10:45   ` Hans de Goede
2020-11-27 14:58     ` Mike Travis
2020-11-27 18:06       ` Hans de Goede
2020-11-25 17:29 ` [PATCH 5/5] x86/platform/uv: Update sysfs document file Mike Travis
2020-11-26 10:44 ` [PATCH 0/5] x86/platform/uv: Move UV procfs leaves to sysfs Hans de Goede
2020-11-27 14:41   ` Mike Travis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).