Messages in this thread | | | From | Robert Richter <> | Subject | Re: [PATCH 11/21] EDAC, ghes: Unify trace_mc_event() code with edac_mc driver | Date | Thu, 13 Jun 2019 22:23:18 +0000 |
| |
On 04.06.19 18:15:50, James Morse wrote: > On 03/06/2019 14:10, Robert Richter wrote: > > The +1 looks odd to me also for the edac_mc driver, but I need to take > > a closer look here as well as some logs suggest the grain is > > calculated correctly. > > My theory on this is that ghes_edac.c is generating a grain like 0x1000, fls() does the > right thing. Other edac drivers are generating a grain like 0xfff to describe the same > size, fls() is now off-by-one, hence the addition. > I don't have a platform where I can trigger any other edac driver to test this though. > > The way round this would be to put the grain_bits in struct edac_raw_error_desc so that > ghes_edac.c can calculate it directly.
I think the grain calculation in edac_mc is broken from the beginning:
53f2d0289875 RAS: Add a tracepoint for reporting memory controller events
The log we see in the patch desc is:
mc_event: 1 Corrected error:memory read on memory stick DIMM_1A (mc:0 location:0:0:0 page:0x586b6e offset:0xa66 grain:32 syndrome:0x0 area:DMA)
The grain reported in mc_event there is probably 8 (quad word, granularity in bytes) and calculates as follows:
dimm->grain = 8 e->grain = dimm->grain grain_bits = fls_long(e->grain) + 1 = 4 + 1 = 5 __entry->grain_bits = grain_bits TP_printk() = 1 << __entry->grain_bits = 2 << 5 = 32
So the reported grain of 32 should actually be 8.
I think the following is correct:
grain_bits = fls_long(e->grain ? e->grain - 1 : 0);
This also handles the case if e->grain is not a power of 2.
Thoughts?
-Robert
| |