Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1565748

[tip:ras/core] x86/ras/amd: Make sysfs names of banks more user-friendly

From tip-bot for Yazen Ghannam <tipbot@zytor.com>
Newsgroups linux.kernel
Subject [tip:ras/core] x86/ras/amd: Make sysfs names of banks more user-friendly
Date 2017-01-24 10:50 +0100
Message-ID <t35TI-2Be-21@gated-at.bofh.it> (permalink)
References <t35TI-2Be-23@gated-at.bofh.it> <t2RH6-1v8-81@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Commit-ID:  0b737a9c2af85cc8295f9308d9250f9111bbf94d
Gitweb:     http://git.kernel.org/tip/0b737a9c2af85cc8295f9308d9250f9111bbf94d
Author:     Yazen Ghannam <Yazen.Ghannam@amd.com>
AuthorDate: Mon, 23 Jan 2017 19:35:08 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 24 Jan 2017 09:14:53 +0100

x86/ras/amd: Make sysfs names of banks more user-friendly

Currently, we append the MCA_IPID[InstanceId] to the bank name to create
the sysfs filename. The InstanceId field uniquely identifies a bank
instance but it doesn't look very nice for most banks.

Replace the InstanceId with a simpler, ascending (0, 1, ..) value.
Only use this in the sysfs name when there is more than 1 instance.
Otherwise, just use the bank's name as the sysfs name.

Signed-off-by: Yazen Ghannam <Yazen.Ghannam@amd.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Tony Luck <tony.luck@intel.com>
Cc: linux-edac <linux-edac@vger.kernel.org>
Link: http://lkml.kernel.org/r/1484322741-41884-3-git-send-email-Yazen.Ghannam@amd.com
Link: http://lkml.kernel.org/r/20170123183514.13356-4-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/include/asm/mce.h           | 5 +++--
 arch/x86/kernel/cpu/mcheck/mce_amd.c | 6 +++++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index a09ed05..528f6ec 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -356,12 +356,13 @@ struct smca_hwid {
 	unsigned int bank_type;	/* Use with smca_bank_types for easy indexing. */
 	u32 hwid_mcatype;	/* (hwid,mcatype) tuple */
 	u32 xec_bitmap;		/* Bitmap of valid ExtErrorCodes; current max is 21. */
+	u8 count;		/* Number of instances. */
 };
 
 struct smca_bank {
 	struct smca_hwid *hwid;
-	/* Instance ID */
-	u32 id;
+	u32 id;			/* Value of MCA_IPID[InstanceId]. */
+	u8 sysfs_id;		/* Value used for sysfs name. */
 };
 
 extern struct smca_bank smca_banks[MAX_NR_BANKS];
diff --git a/arch/x86/kernel/cpu/mcheck/mce_amd.c b/arch/x86/kernel/cpu/mcheck/mce_amd.c
index a5fd137..776379e 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_amd.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_amd.c
@@ -192,6 +192,7 @@ static void get_smca_bank_info(unsigned int bank)
 
 			smca_banks[bank].hwid = s_hwid;
 			smca_banks[bank].id = instance_id;
+			smca_banks[bank].sysfs_id = s_hwid->count++;
 			break;
 		}
 	}
@@ -1064,9 +1065,12 @@ static const char *get_name(unsigned int bank, struct threshold_block *b)
 		return NULL;
 	}
 
+	if (smca_banks[bank].hwid->count == 1)
+		return smca_get_name(bank_type);
+
 	snprintf(buf_mcatype, MAX_MCATYPE_NAME_LEN,
 		 "%s_%x", smca_get_name(bank_type),
-			  smca_banks[bank].id);
+			  smca_banks[bank].sysfs_id);
 	return buf_mcatype;
 }
 

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 0/9] x86/RAS: Queue for 4.11 Borislav Petkov <bp@alien8.de> - 2017-01-23 19:40 +0100
  [PATCH 9/9] x86/MCE, EDAC, acpi: Assign MCE notifier handlers a priority Borislav Petkov <bp@alien8.de> - 2017-01-23 19:40 +0100
    [tip:ras/core] x86/ras, EDAC, acpi: Assign MCE notifier handlers a  priority tip-bot for Borislav Petkov <tipbot@zytor.com> - 2017-01-24 10:00 +0100
  [PATCH 5/9] x86/ras/mce_amd_inj: Change dependency Borislav Petkov <bp@alien8.de> - 2017-01-23 19:40 +0100
    [tip:ras/core] x86/ras/amd/inj: Change dependency tip-bot for Borislav Petkov <tipbot@zytor.com> - 2017-01-24 09:50 +0100
  [PATCH 1/9] x86/mce-inject: Make it depend on X86_LOCAL_APIC Borislav Petkov <bp@alien8.de> - 2017-01-23 19:40 +0100
    [tip:ras/core] x86/ras/inject: Make it depend on X86_LOCAL_APIC=y tip-bot for Borislav Petkov <tipbot@zytor.com> - 2017-01-24 09:50 +0100
  [PATCH 8/9] x86/MCE: Get rid of mce_process_work() Borislav Petkov <bp@alien8.de> - 2017-01-23 19:40 +0100
    [tip:ras/core] x86/ras: Get rid of mce_process_work() tip-bot for Borislav Petkov <tipbot@zytor.com> - 2017-01-24 10:00 +0100
  [PATCH 3/9] x86/MCE/AMD: Make sysfs names of banks more user-friendly Borislav Petkov <bp@alien8.de> - 2017-01-23 19:40 +0100
    [tip:ras/core] x86/ras/amd: Make sysfs names of banks more  user-friendly tip-bot for Yazen Ghannam <tipbot@zytor.com> - 2017-01-24 10:50 +0100

csiph-web