All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] EDAC/mc_sysfs: Print MC-scope sysfs counters unsigned
@ 2021-10-03 18:16 Eric Badger
  2021-10-04 15:21 ` Luck, Tony
  2021-10-07 10:21 ` Borislav Petkov
  0 siblings, 2 replies; 4+ messages in thread
From: Eric Badger @ 2021-10-03 18:16 UTC (permalink / raw)
  To: ebadger
  Cc: Eric Badger, Borislav Petkov, Mauro Carvalho Chehab, Tony Luck,
	James Morse, Robert Richter, open list:EDAC-CORE, open list

This is cosmetically nicer for counts > INT32_MAX, and aligns the
MC-scope format with that of the lower layer sysfs counter files.

Signed-off-by: Eric Badger <ebadger@purestorage.com>
---
 drivers/edac/edac_mc_sysfs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/edac/edac_mc_sysfs.c b/drivers/edac/edac_mc_sysfs.c
index 2f9f1e7..0a638c9 100644
--- a/drivers/edac/edac_mc_sysfs.c
+++ b/drivers/edac/edac_mc_sysfs.c
@@ -744,7 +744,7 @@ static ssize_t mci_ue_count_show(struct device *dev,
 {
 	struct mem_ctl_info *mci = to_mci(dev);
 
-	return sprintf(data, "%d\n", mci->ue_mc);
+	return sprintf(data, "%u\n", mci->ue_mc);
 }
 
 static ssize_t mci_ce_count_show(struct device *dev,
@@ -753,7 +753,7 @@ static ssize_t mci_ce_count_show(struct device *dev,
 {
 	struct mem_ctl_info *mci = to_mci(dev);
 
-	return sprintf(data, "%d\n", mci->ce_mc);
+	return sprintf(data, "%u\n", mci->ce_mc);
 }
 
 static ssize_t mci_ce_noinfo_show(struct device *dev,
@@ -762,7 +762,7 @@ static ssize_t mci_ce_noinfo_show(struct device *dev,
 {
 	struct mem_ctl_info *mci = to_mci(dev);
 
-	return sprintf(data, "%d\n", mci->ce_noinfo_count);
+	return sprintf(data, "%u\n", mci->ce_noinfo_count);
 }
 
 static ssize_t mci_ue_noinfo_show(struct device *dev,
@@ -771,7 +771,7 @@ static ssize_t mci_ue_noinfo_show(struct device *dev,
 {
 	struct mem_ctl_info *mci = to_mci(dev);
 
-	return sprintf(data, "%d\n", mci->ue_noinfo_count);
+	return sprintf(data, "%u\n", mci->ue_noinfo_count);
 }
 
 static ssize_t mci_seconds_show(struct device *dev,
-- 
1.9.1


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

* RE: [PATCH] EDAC/mc_sysfs: Print MC-scope sysfs counters unsigned
  2021-10-03 18:16 [PATCH] EDAC/mc_sysfs: Print MC-scope sysfs counters unsigned Eric Badger
@ 2021-10-04 15:21 ` Luck, Tony
  2021-10-04 16:53   ` Eric Badger
  2021-10-07 10:21 ` Borislav Petkov
  1 sibling, 1 reply; 4+ messages in thread
From: Luck, Tony @ 2021-10-04 15:21 UTC (permalink / raw)
  To: Eric Badger
  Cc: Borislav Petkov, Mauro Carvalho Chehab, James Morse,
	Robert Richter, open list:EDAC-CORE, open list

> This is cosmetically nicer for counts > INT32_MAX, and aligns the
> MC-scope format with that of the lower layer sysfs counter files.

While this is technically the right thing to do, I pity the system administrator that
is looking at a system with more than 2147483647 corrected or uncorrected errors!

So:

Acked-by: Tony Luck <tony.luck@intel.com>

but maybe this is just churn and not really useful in practice?

-Tony

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

* Re: [PATCH] EDAC/mc_sysfs: Print MC-scope sysfs counters unsigned
  2021-10-04 15:21 ` Luck, Tony
@ 2021-10-04 16:53   ` Eric Badger
  0 siblings, 0 replies; 4+ messages in thread
From: Eric Badger @ 2021-10-04 16:53 UTC (permalink / raw)
  To: Luck, Tony
  Cc: Borislav Petkov, Mauro Carvalho Chehab, James Morse,
	Robert Richter, open list:EDAC-CORE, open list

On Mon, Oct 04, 2021 at 03:21:13PM +0000, Luck, Tony wrote:
> > This is cosmetically nicer for counts > INT32_MAX, and aligns the
> > MC-scope format with that of the lower layer sysfs counter files.
> 
> While this is technically the right thing to do, I pity the system administrator that
> is looking at a system with more than 2147483647 corrected or uncorrected errors!
> 
> So:
> 
> Acked-by: Tony Luck <tony.luck@intel.com>
> 
> but maybe this is just churn and not really useful in practice?

Pity accepted :). I only noticed the sign mismatch after seeing a
negative value on a server in the wild. But it's cosmetic really; if
you've reached INT32_MAX you'll probably reach UINT32_MAX and can't rely
on the counter.

Cheers,
Eric

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

* Re: [PATCH] EDAC/mc_sysfs: Print MC-scope sysfs counters unsigned
  2021-10-03 18:16 [PATCH] EDAC/mc_sysfs: Print MC-scope sysfs counters unsigned Eric Badger
  2021-10-04 15:21 ` Luck, Tony
@ 2021-10-07 10:21 ` Borislav Petkov
  1 sibling, 0 replies; 4+ messages in thread
From: Borislav Petkov @ 2021-10-07 10:21 UTC (permalink / raw)
  To: Eric Badger
  Cc: Mauro Carvalho Chehab, Tony Luck, James Morse, Robert Richter,
	open list:EDAC-CORE, open list

On Sun, Oct 03, 2021 at 11:16:53AM -0700, Eric Badger wrote:
> This is cosmetically nicer for counts > INT32_MAX, and aligns the
> MC-scope format with that of the lower layer sysfs counter files.
> 
> Signed-off-by: Eric Badger <ebadger@purestorage.com>
> ---
>  drivers/edac/edac_mc_sysfs.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

Applied, thanks.

-- 
Regards/Gruss,
    Boris.

https://people.kernel.org/tglx/notes-about-netiquette

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

end of thread, other threads:[~2021-10-07 10:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-03 18:16 [PATCH] EDAC/mc_sysfs: Print MC-scope sysfs counters unsigned Eric Badger
2021-10-04 15:21 ` Luck, Tony
2021-10-04 16:53   ` Eric Badger
2021-10-07 10:21 ` Borislav Petkov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.