<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux/drivers/edac, branch v3.6</title>
<subtitle>Linux kernel source tree</subtitle>
<id>https://git.amat.us/linux/atom/drivers/edac?h=v3.6</id>
<link rel='self' href='https://git.amat.us/linux/atom/drivers/edac?h=v3.6'/>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/'/>
<updated>2012-09-25T10:38:20Z</updated>
<entry>
<title>sb_edac: Avoid overflow errors at memory size calculation</title>
<updated>2012-09-25T10:38:20Z</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab@redhat.com</email>
</author>
<published>2012-09-20T15:09:30Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=deb09ddaff1435f72dd598d38f9b58354c68a5ec'/>
<id>urn:sha1:deb09ddaff1435f72dd598d38f9b58354c68a5ec</id>
<content type='text'>
Sandy bridge EDAC is calculating the memory size with overflow.
Basically, the size field and the integer calculation is using 32 bits.
More bits are needed, when the DIMM memories have high density.

The net result is that memories are improperly reported there, when
high-density DIMMs are used:

EDAC DEBUG: in drivers/edac/sb_edac.c, line at 591: mc#0: channel 0, dimm 0, -16384 Mb (-4194304 pages) bank: 8, rank: 2, row: 0x10000, col: 0x800
EDAC DEBUG: in drivers/edac/sb_edac.c, line at 591: mc#0: channel 1, dimm 0, -16384 Mb (-4194304 pages) bank: 8, rank: 2, row: 0x10000, col: 0x800

As the number of pages value is handled at the EDAC core as unsigned
ints, the driver shows the 16 GB memories at sysfs interface as 16760832
MB! The fix is simple: calculate the number of pages as unsigned 64-bits
integer.

After the patch, the memory size (16 GB) is properly detected:

EDAC DEBUG: in drivers/edac/sb_edac.c, line at 592: mc#0: channel 0, dimm 0, 16384 Mb (4194304 pages) bank: 8, rank: 2, row: 0x10000, col: 0x800
EDAC DEBUG: in drivers/edac/sb_edac.c, line at 592: mc#0: channel 1, dimm 0, 16384 Mb (4194304 pages) bank: 8, rank: 2, row: 0x10000, col: 0x800

Cc: stable@kernel.org
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@redhat.com&gt;
</content>
</entry>
<entry>
<title>i5000: Fix the memory size calculation with 2R memories</title>
<updated>2012-09-25T10:38:19Z</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab@redhat.com</email>
</author>
<published>2012-09-10T16:25:50Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=b70f833377fc80d7446218b36206e2e299fc6bfd'/>
<id>urn:sha1:b70f833377fc80d7446218b36206e2e299fc6bfd</id>
<content type='text'>
When 2R memories are found, the memory size should be multiplied
by two, otherwise, it will report half of the memory size:

       +-----------------------------------------------+
       |                      mc0                      |
       |        branch0        |        branch1        |
       | channel0  | channel1  | channel0  | channel1  |
-------+-----------------------------------------------+
slot3: |     0 MB  |     0 MB  |     0 MB  |     0 MB  |
slot2: |     0 MB  |     0 MB  |     0 MB  |     0 MB  |
-------+-----------------------------------------------+
slot1: |     0 MB  |     0 MB  |     0 MB  |     0 MB  |
slot0: |  1024 MB  |  1024 MB  |  1024 MB  |  1024 MB  |
-------+-----------------------------------------------+

(the above machine have 4 x 2GB 2R memories)

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@redhat.com&gt;
</content>
</entry>
<entry>
<title>i3200_edac: Fix memory rank size</title>
<updated>2012-09-25T10:32:33Z</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab@redhat.com</email>
</author>
<published>2012-08-02T20:58:23Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=582a899622f19005126d2858f08ee0c9dac34870'/>
<id>urn:sha1:582a899622f19005126d2858f08ee0c9dac34870</id>
<content type='text'>
commit a895bf8b1e1ea4c032a8fa8a09475a2ce09fe77a incorrectly
changed the logic that fills the memory bank size. Fix it.

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@redhat.com&gt;
</content>
</entry>
<entry>
<title>edac_mc: edac_mc_free() cannot assume mem_ctl_info is registered in sysfs.</title>
<updated>2012-09-23T21:46:40Z</updated>
<author>
<name>Shaun Ruffell</name>
<email>sruffell@digium.com</email>
</author>
<published>2012-09-23T01:26:38Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=faa2ad09c01c48012fe4c117d3256e354e0f9238'/>
<id>urn:sha1:faa2ad09c01c48012fe4c117d3256e354e0f9238</id>
<content type='text'>
Fix potential NULL pointer dereference in edac_unregister_sysfs() on
system boot introduced in 3.6-rc1.

Since commit 7a623c039 ("edac: rewrite the sysfs code to use struct
device") edac_mc_alloc() no longer initializes embedded kobjects in
struct mem_ctl_info.  Therefore edac_mc_free() can no longer simply
decrement a kobject reference count to free the allocated memory unless
the memory controller driver module had also called edac_mc_add_mc().

Now edac_mc_free() will check if the newly embedded struct device has
been registered with sysfs before using either the standard device
release functions or freeing the data structures itself with logic
pulled out of the error path of edac_mc_alloc().

The BUG this patch resolves for me:

  BUG: unable to handle kernel NULL pointer dereference at   (null)
  EIP is at __wake_up_common+0x1a/0x6a
  Process modprobe (pid: 933, ti=f3dc6000 task=f3db9520 task.ti=f3dc6000)
  Call Trace:
    complete_all+0x3f/0x50
    device_pm_remove+0x23/0xa2
    device_del+0x34/0x142
    edac_unregister_sysfs+0x3b/0x5c [edac_core]
    edac_mc_free+0x29/0x2f [edac_core]
    e7xxx_probe1+0x268/0x311 [e7xxx_edac]
    e7xxx_init_one+0x56/0x61 [e7xxx_edac]
    local_pci_probe+0x13/0x15
  ...

Cc: Mauro Carvalho Chehab &lt;mchehab@redhat.com&gt;
Cc: Shaohui Xie &lt;Shaohui.Xie@freescale.com&gt;
Signed-off-by: Shaun Ruffell &lt;sruffell@digium.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>edac_mc: fix messy kfree calls in the error path</title>
<updated>2012-09-23T21:45:26Z</updated>
<author>
<name>Fengguang Wu</name>
<email>fengguang.wu@intel.com</email>
</author>
<published>2012-09-23T00:18:06Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=ef6e7816b4546475d04b4ea22d58c48472157c70'/>
<id>urn:sha1:ef6e7816b4546475d04b4ea22d58c48472157c70</id>
<content type='text'>
coccinelle warns about:

+ drivers/edac/edac_mc.c:429:9-23: ERROR: reference preceded by free on line 429

   421         if (mci-&gt;csrows) {
 &gt; 422                 for (chn = 0; chn &lt; tot_channels; chn++) {
   423                         csr = mci-&gt;csrows[chn];
   424                         if (csr) {
 &gt; 425                                 for (chn = 0; chn &lt; tot_channels; chn++)
   426                                          kfree(csr-&gt;channels[chn]);
   427                                  kfree(csr);
   428                          }
 &gt; 429                          kfree(mci-&gt;csrows[i]);
   430                  }
   431                  kfree(mci-&gt;csrows);
   432          }

and that code block seem to mess things up in several ways (double free, memory
leak, out-of-bound reads etc.):

L422: The iterator "chn" and bound "tot_channels" are totally wrong. Should be
      "row" and "tot_csrows" respectively. Which means either memory leak, or
      out-of-bound reads (which if does not trigger an immediate page fault
      error, will further lead to kfree() on random addresses).

L425: The inner loop is reusing the same iterator "chn" as the outer loop,
      which could lead to premature end of the outer loop, and hence memory leak.

L429: The array index 'i' in mci-&gt;csrows[i] is a temporary value used in
      previous loops, and won't change at all in the current loop. Which
      means either out-of-bound read and possibly kfree(random number), or the
      same mci-&gt;csrows[i] get freed once and again, and possibly double free
      for the kfree(csr) in L427.

L426/L427: a kfree(csr-&gt;channels) is needed in between to avoid leaking the memory.

The buggy code was introduced by commit de3910eb ("edac: change the mem
allocation scheme to make Documentation/kobject.txt happy") in the 3.6-rc1
merge window. Fix it by freeing up resources in this order:

  free csrows[i]-&gt;channels[j]
  free csrows[i]-&gt;channels
  free csrows[i]
  free csrows

CC: Mauro Carvalho Chehab &lt;mchehab@redhat.com&gt;
CC: Shaun Ruffell &lt;sruffell@digium.com&gt;
Signed-off-by: Fengguang Wu &lt;fengguang.wu@intel.com&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'devel'</title>
<updated>2012-07-30T00:11:05Z</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab@redhat.com</email>
</author>
<published>2012-07-30T00:11:05Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=c2078e4c9120e7b38b1a02cd9fc6dd4f792110bf'/>
<id>urn:sha1:c2078e4c9120e7b38b1a02cd9fc6dd4f792110bf</id>
<content type='text'>
* devel: (33 commits)
  edac i5000, i5400: fix pointer math in i5000_get_mc_regs()
  edac: allow specifying the error count with fake_inject
  edac: add support for Calxeda highbank L2 cache ecc
  edac: add support for Calxeda highbank memory controller
  edac: create top-level debugfs directory
  sb_edac: properly handle error count
  i7core_edac: properly handle error count
  edac: edac_mc_handle_error(): add an error_count parameter
  edac: remove arch-specific parameter for the error handler
  amd64_edac: Don't pass driver name as an error parameter
  edac_mc: check for allocation failure in edac_mc_alloc()
  edac: Increase version to 3.0.0
  edac_mc: Cleanup per-dimm_info debug messages
  edac: Convert debugfX to edac_dbg(X,
  edac: Use more normal debugging macro style
  edac: Don't add __func__ or __FILE__ for debugf[0-9] msgs
  Edac: Add ABI Documentation for the new device nodes
  edac: move documentation ABI to ABI/testing/sysfs-devices-edac
  i7core_edac: change the mem allocation scheme to make Documentation/kobject.txt happy
  edac: change the mem allocation scheme to make Documentation/kobject.txt happy
  ...
</content>
</entry>
<entry>
<title>edac i5000, i5400: fix pointer math in i5000_get_mc_regs()</title>
<updated>2012-06-27T12:08:40Z</updated>
<author>
<name>Dan Carpenter</name>
<email>dan.carpenter@oracle.com</email>
</author>
<published>2012-06-27T09:07:58Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=f58d0dee07fe6328f775669eb6aa3a123efad6c2'/>
<id>urn:sha1:f58d0dee07fe6328f775669eb6aa3a123efad6c2</id>
<content type='text'>
"pvt-&gt;ambase" is a u64 datatype.  The intent here is to fill the first
half in the first call to pci_read_config_dword() and the other half in
the second.  Unfortunately the pointer math is wrong so we set the wrong
data.

Signed-off-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@redhat.com&gt;
</content>
</entry>
<entry>
<title>edac: allow specifying the error count with fake_inject</title>
<updated>2012-06-27T12:01:30Z</updated>
<author>
<name>Mauro Carvalho Chehab</name>
<email>mchehab@redhat.com</email>
</author>
<published>2012-06-12T13:55:57Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=38ced28b21efff18fd5e5c98a92830e8f0031cee'/>
<id>urn:sha1:38ced28b21efff18fd5e5c98a92830e8f0031cee</id>
<content type='text'>
In order to test if the error counters are properly incremented,
add a way to specify how many errors were generated by a trace.

Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@redhat.com&gt;
</content>
</entry>
<entry>
<title>edac: add support for Calxeda highbank L2 cache ecc</title>
<updated>2012-06-27T12:01:29Z</updated>
<author>
<name>Rob Herring</name>
<email>rob.herring@calxeda.com</email>
</author>
<published>2012-06-12T02:32:14Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=69154d069869b612383cef9d594f39b34ffba6dd'/>
<id>urn:sha1:69154d069869b612383cef9d594f39b34ffba6dd</id>
<content type='text'>
Add support for L2 ECC on Calxeda highbank platform.

Signed-off-by: Rob Herring &lt;rob.herring@calxeda.com&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@redhat.com&gt;
</content>
</entry>
<entry>
<title>edac: add support for Calxeda highbank memory controller</title>
<updated>2012-06-27T12:00:57Z</updated>
<author>
<name>Rob Herring</name>
<email>rob.herring@calxeda.com</email>
</author>
<published>2012-06-13T17:01:55Z</published>
<link rel='alternate' type='text/html' href='https://git.amat.us/linux/commit/?id=a1b01edb274518c7da6d69b84e7558c092282aad'/>
<id>urn:sha1:a1b01edb274518c7da6d69b84e7558c092282aad</id>
<content type='text'>
Add support for memory controller on Calxeda Highbank platforms. Highbank
platforms support a single 4GB mini-DIMM with 1-bit correction and 2-bit
detection.

Signed-off-by: Rob Herring &lt;rob.herring@calxeda.com&gt;
Signed-off-by: Mauro Carvalho Chehab &lt;mchehab@redhat.com&gt;
</content>
</entry>
</feed>
