mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: stable@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Jim Snow <jim.m.snow@intel.com>,
	Jim Snow <jim.snow@intel.com>,
	Lukasz Anaczkowski <lukasz.anaczkowski@intel.com>,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	Jiri Slaby <jslaby@suse.cz>
Subject: [PATCH 3.12 65/83] sb_edac: Fix erroneous bytes->gigabytes conversion
Date: Mon, 27 Apr 2015 23:32:36 +0200	[thread overview]
Message-ID: <0fd2dc596b4cbfe1cafc157c2b4ea30dbb95bece.1430159990.git.jslaby@suse.cz> (raw)
In-Reply-To: <3426bb8de3a655aa6668e92ee92eb35f0db86582.1430159990.git.jslaby@suse.cz>
In-Reply-To: <cover.1430159990.git.jslaby@suse.cz>

From: Jim Snow <jim.m.snow@intel.com>

3.12-stable review patch.  If anyone has any objections, please let me know.

===============

commit 8c009100295597f23978c224aec5751a365bc965 upstream.

Signed-off-by: Jim Snow <jim.snow@intel.com>
Signed-off-by: Lukasz Anaczkowski <lukasz.anaczkowski@intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/edac/sb_edac.c | 38 ++++++++++++++++++++------------------
 1 file changed, 20 insertions(+), 18 deletions(-)

diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c
index e04462b60756..952a956288e4 100644
--- a/drivers/edac/sb_edac.c
+++ b/drivers/edac/sb_edac.c
@@ -622,7 +622,7 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
 	u32 reg;
 	u64 limit, prv = 0;
 	u64 tmp_mb;
-	u32 mb, kb;
+	u32 gb, mb;
 	u32 rir_way;
 
 	/*
@@ -635,8 +635,9 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
 	pvt->tolm = GET_TOLM(reg);
 	tmp_mb = (1 + pvt->tolm) >> 20;
 
-	mb = div_u64_rem(tmp_mb, 1000, &kb);
-	edac_dbg(0, "TOLM: %u.%03u GB (0x%016Lx)\n", mb, kb, (u64)pvt->tolm);
+	gb = div_u64_rem(tmp_mb, 1024, &mb);
+	edac_dbg(0, "TOLM: %u.%03u GB (0x%016Lx)\n",
+		gb, (mb*1000)/1024, (u64)pvt->tolm);
 
 	/* Address range is already 45:25 */
 	pci_read_config_dword(pvt->pci_sad1, TOHM,
@@ -644,8 +645,9 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
 	pvt->tohm = GET_TOHM(reg);
 	tmp_mb = (1 + pvt->tohm) >> 20;
 
-	mb = div_u64_rem(tmp_mb, 1000, &kb);
-	edac_dbg(0, "TOHM: %u.%03u GB (0x%016Lx)\n", mb, kb, (u64)pvt->tohm);
+	gb = div_u64_rem(tmp_mb, 1024, &mb);
+	edac_dbg(0, "TOHM: %u.%03u GB (0x%016Lx)\n",
+		gb, (mb*1000)/1024, (u64)pvt->tohm);
 
 	/*
 	 * Step 2) Get SAD range and SAD Interleave list
@@ -667,11 +669,11 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
 			break;
 
 		tmp_mb = (limit + 1) >> 20;
-		mb = div_u64_rem(tmp_mb, 1000, &kb);
+		gb = div_u64_rem(tmp_mb, 1024, &mb);
 		edac_dbg(0, "SAD#%d %s up to %u.%03u GB (0x%016Lx) Interleave: %s reg=0x%08x\n",
 			 n_sads,
 			 get_dram_attr(reg),
-			 mb, kb,
+			 gb, (mb*1000)/1024,
 			 ((u64)tmp_mb) << 20L,
 			 INTERLEAVE_MODE(reg) ? "8:6" : "[8:6]XOR[18:16]",
 			 reg);
@@ -701,9 +703,9 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
 			break;
 		tmp_mb = (limit + 1) >> 20;
 
-		mb = div_u64_rem(tmp_mb, 1000, &kb);
+		gb = div_u64_rem(tmp_mb, 1024, &mb);
 		edac_dbg(0, "TAD#%d: up to %u.%03u GB (0x%016Lx), socket interleave %d, memory interleave %d, TGT: %d, %d, %d, %d, reg=0x%08x\n",
-			 n_tads, mb, kb,
+			 n_tads, gb, (mb*1000)/1024,
 			 ((u64)tmp_mb) << 20L,
 			 (u32)TAD_SOCK(reg),
 			 (u32)TAD_CH(reg),
@@ -726,10 +728,10 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
 					      tad_ch_nilv_offset[j],
 					      &reg);
 			tmp_mb = TAD_OFFSET(reg) >> 20;
-			mb = div_u64_rem(tmp_mb, 1000, &kb);
+			gb = div_u64_rem(tmp_mb, 1024, &mb);
 			edac_dbg(0, "TAD CH#%d, offset #%d: %u.%03u GB (0x%016Lx), reg=0x%08x\n",
 				 i, j,
-				 mb, kb,
+				 gb, (mb*1000)/1024,
 				 ((u64)tmp_mb) << 20L,
 				 reg);
 		}
@@ -751,10 +753,10 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
 
 			tmp_mb = RIR_LIMIT(reg) >> 20;
 			rir_way = 1 << RIR_WAY(reg);
-			mb = div_u64_rem(tmp_mb, 1000, &kb);
+			gb = div_u64_rem(tmp_mb, 1024, &mb);
 			edac_dbg(0, "CH#%d RIR#%d, limit: %u.%03u GB (0x%016Lx), way: %d, reg=0x%08x\n",
 				 i, j,
-				 mb, kb,
+				 gb, (mb*1000)/1024,
 				 ((u64)tmp_mb) << 20L,
 				 rir_way,
 				 reg);
@@ -765,10 +767,10 @@ static void get_memory_layout(const struct mem_ctl_info *mci)
 						      &reg);
 				tmp_mb = RIR_OFFSET(reg) << 6;
 
-				mb = div_u64_rem(tmp_mb, 1000, &kb);
+				gb = div_u64_rem(tmp_mb, 1024, &mb);
 				edac_dbg(0, "CH#%d RIR#%d INTL#%d, offset %u.%03u GB (0x%016Lx), tgt: %d, reg=0x%08x\n",
 					 i, j, k,
-					 mb, kb,
+					 gb, (mb*1000)/1024,
 					 ((u64)tmp_mb) << 20L,
 					 (u32)RIR_RNK_TGT(reg),
 					 reg);
@@ -805,7 +807,7 @@ static int get_memory_error_data(struct mem_ctl_info *mci,
 	u8			ch_way,sck_way;
 	u32			tad_offset;
 	u32			rir_way;
-	u32			mb, kb;
+	u32			mb, gb;
 	u64			ch_addr, offset, limit, prv = 0;
 
 
@@ -1021,10 +1023,10 @@ static int get_memory_error_data(struct mem_ctl_info *mci,
 			continue;
 
 		limit = RIR_LIMIT(reg);
-		mb = div_u64_rem(limit >> 20, 1000, &kb);
+		gb = div_u64_rem(limit >> 20, 1024, &mb);
 		edac_dbg(0, "RIR#%d, limit: %u.%03u GB (0x%016Lx), way: %d\n",
 			 n_rir,
-			 mb, kb,
+			 gb, (mb*1000)/1024,
 			 limit,
 			 1 << RIR_WAY(reg));
 		if  (ch_addr <= limit)
-- 
2.3.5


  parent reply	other threads:[~2015-04-27 21:34 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-27 21:31 [PATCH 3.12 00/83] 3.12.41-stable review Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 01/83] core, nfqueue, openvswitch: fix compilation warning Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 02/83] arm64: Use the reserved TTBR0 if context switching to the init_mm Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 03/83] powerpc/pseries: Little endian fixes for post mobility device tree update Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 04/83] net: ethernet: pcnet32: Setup the SRAM and NOUFLO on Am79C97{3, 5} Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 05/83] mfd: kempld-core: Fix callback return value check Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 06/83] x86/reboot: Remove the duplicate C6100 entry in the reboot quirks list Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 07/83] x86/reboot: Sort reboot DMI quirks by vendor Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 08/83] x86/reboot: Add reboot quirk for Certec BPC600 Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 09/83] n_tty: Merge .receive_buf() flavors Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 10/83] conditionally define U32_MAX Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 11/83] kernel.h: define u8, s8, u32, etc. limits Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 12/83] remove extra definitions of U32_MAX Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 13/83] ALSA: hda - Add one more node in the EAPD supporting candidate list Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 14/83] ALSA: usb - Creative USB X-Fi Pro SB1095 volume knob support Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 15/83] ALSA: hda/realtek - Make more stable to get pin sense for ALC283 Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 16/83] ALSA: hda - Fix headphone pin config for Lifebook T731 Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 17/83] ARC: SA_SIGINFO ucontext regs off-by-one Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 18/83] selinux: fix sel_write_enforce broken return value Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 19/83] tcp: Fix crash in TCP Fast Open Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 20/83] IB/uverbs: Prevent integer overflow in ib_umem_get address arithmetic Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 21/83] iwlwifi: dvm: run INIT firmware again upon .start() Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 22/83] nbd: fix possible memory leak Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 23/83] mm/memory hotplug: postpone the reset of obsolete pgdat Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 24/83] sched: Fix RLIMIT_RTTIME when PI-boosting to RT Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 25/83] writeback: add missing INITIAL_JIFFIES init in global_update_bandwidth() Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 26/83] writeback: fix possible underflow in write bandwidth calculation Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 27/83] radeon: Do not directly dereference pointers to BIOS area Jiri Slaby
2015-04-27 21:31 ` [PATCH 3.12 28/83] USB: ftdi_sio: Added custom PID for Synapse Wireless product Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 29/83] USB: ftdi_sio: Use jtag quirk for SNAP Connect E10 Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 30/83] Defer processing of REQ_PREEMPT requests for blocked devices Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 31/83] iio: inv_mpu6050: Clear timestamps fifo while resetting hardware fifo Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 32/83] iio: imu: Use iio_trigger_get for indio_dev->trig assignment Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 33/83] dmaengine: omap-dma: Fix memory leak when terminating running transfer Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 34/83] x86/reboot: Add ASRock Q1900DC-ITX mainboard reboot quirk Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 35/83] can: flexcan: Deferred on Regulator return EPROBE_DEFER Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 36/83] usb: xhci: handle Config Error Change (CEC) in xhci driver Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 37/83] usb: xhci: apply XHCI_AVOID_BEI quirk to all Intel xHCI controllers Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 38/83] tty: serial: fsl_lpuart: clear receive flag on FIFO flush Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 39/83] n_tty: Fix read buffer overwrite when no newline Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 40/83] cifs: fix use-after-free bug in find_writable_file Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 41/83] be2iscsi: Fix kernel panic when device initialization fails Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 42/83] ocfs2: _really_ sync the right range Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 43/83] ioctx_alloc(): fix vma (and file) leak on failure Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 44/83] iscsi target: fix oops when adding reject pdu Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 45/83] sh_veu: v4l2_dev wasn't set Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 46/83] media: s5p-mfc: fix mmap support for 64bit arch Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 47/83] net: rds: use correct size for max unacked packets and bytes Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 48/83] net: llc: use correct size for sysctl timeout entries Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 49/83] IB/mlx4: Saturate RoCE port PMA counters in case of overflow Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 50/83] [media] drivers: media: usb: b2c2: use usb_*_coherent() instead of pci_*_consistent() in flexcop-usb.c Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 51/83] video: vgacon: Don't build on arm64 Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 52/83] tcp: prevent fetching dst twice in early demux code Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 53/83] ipv6: Don't reduce hop limit for an interface Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 54/83] tcp: fix FRTO undo on cumulative ACK of SACKed range Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 55/83] tcp: tcp_make_synack() should clear skb->tstamp Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 56/83] 8139cp: Call dev_kfree_skby_any instead of kfree_skb Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 57/83] 8139too: Call dev_kfree_skby_any instead of dev_kfree_skb Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 58/83] r8169: " Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 59/83] bonding: Call dev_kfree_skby_any instead of kfree_skb Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 60/83] bnx2: Call dev_kfree_skby_any instead of dev_kfree_skb Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 61/83] tg3: " Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 62/83] ixgb: " Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 63/83] benet: Call dev_kfree_skby_any instead of kfree_skb Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 64/83] crypto: testmgr - fix 3.12.40 regression Jiri Slaby
2015-04-27 21:32 ` Jiri Slaby [this message]
2015-04-27 21:32 ` [PATCH 3.12 66/83] sb_edac: avoid INTERNAL ERROR message in EDAC with unspecified channel Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 67/83] cpufreq: fix a NULL pointer dereference in __cpufreq_governor() Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 68/83] libata: Blacklist queued TRIM on Samsung SSD 850 Pro Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 69/83] nick kvfree() from apparmor Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 70/83] KVM: remove redundant assignments in __kvm_set_memory_region Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 71/83] kvm: commonize allocation of the new memory slots Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 72/83] kvm: avoid page allocation failure in kvm_set_memory_region() Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 73/83] Input: sirfsoc-onkey - fix GPL v2 license string typo Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 74/83] Input: twl4030-pwrbutton - ensure a wakeup event is recorded Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 75/83] Bluetooth: ath3k: Add support of MCI 13d3:3408 bt device Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 76/83] Bluetooth: ath3k: Add support of AR3012 bluetooth 13d3:3423 device Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 77/83] Bluetooth: Add USB device 04ca:3010 as Atheros AR3012 Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 78/83] netfilter: conntrack: disable generic tracking for known protocols Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 79/83] KVM: x86: SYSENTER emulation is broken Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 80/83] mm: softdirty: unmapped addresses between VMAs are clean Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 81/83] proc/pagemap: walk page tables under pte lock Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 82/83] Input: elantech - fix crc_enabled for Fujitsu H730 Jiri Slaby
2015-04-27 21:32 ` [PATCH 3.12 83/83] Input: elantech - add more Fujtisu notebooks to force crc_enabled Jiri Slaby
2015-04-28  0:32 ` [PATCH 3.12 00/83] 3.12.41-stable review Shuah Khan
2015-04-30 12:11   ` Jiri Slaby
2015-04-28  1:43 ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0fd2dc596b4cbfe1cafc157c2b4ea30dbb95bece.1430159990.git.jslaby@suse.cz \
    --to=jslaby@suse.cz \
    --cc=jim.m.snow@intel.com \
    --cc=jim.snow@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukasz.anaczkowski@intel.com \
    --cc=mchehab@osg.samsung.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®