Messages in this thread | | | Subject | Re: [PATCH 11/21] EDAC, ghes: Unify trace_mc_event() code with edac_mc driver | From | James Morse <> | Date | Tue, 4 Jun 2019 18:15:50 +0100 |
| |
Hi Robert,
On 03/06/2019 14:10, Robert Richter wrote: > On 29.05.19 16:12:38, James Morse wrote: >> On 29/05/2019 09:44, Robert Richter wrote: >>> Almost duplicate code, remove it. >> >>> Note: there is a difference in the calculation of the grain_bits, >>> using the edac_mc's version here. >> >> But is it the right thing to do? >> >> Is this an off-by-one bug being papered over as some cleanup? >> If so could you post a separate fix that can be picked up for an rc. >> >> Do Marvell have firmware that populates this field? >> >> ... >> >> Unless the argument is no one cares about this... >> >> >From ghes_edac_report_mem_error(): >> | /* Error grain */ >> | if (mem_err->validation_bits & CPER_MEM_VALID_PA_MASK) >> | e->grain = ~(mem_err->physical_addr_mask & ~PAGE_MASK); >> >> Fishy, why would the kernel page-size be relevant here? > > That looked broken to me too, I did not put to much effort in fixing > the grain yet. So I just took the edac_mc version first in the > assumption, that one is working.
(Ah, it would have been good to note this in the commit-message)
> It looks like the intention here is to limit the grain to the page > size. I'm not convinced that makes sense. If some architecture let you configure the page-size, (as arm64 does), and your hypervisor had a bigger page-size, then any hardware fault would be rounded up to hypervisor's page-size.
The kernel's page-size has very little to do with the error, it only matters for when we go unmapping stuff in memory_failure().
> But right, the calculation is wrong here. I am also going to > reply to your patch you sent on this.
Thanks!
>> If physical_addr_mask were the same as PAGE_MASK this wouldn't this always give ~0? >> (masking logic like this always does my head in) >> >> /me gives it ago: >> | {1}[Hardware Error]: physical_address: 0x00000000deadbeef >> | {1}[Hardware Error]: physical_address_mask: 0xffffffffffff0000 >> | {1}[Hardware Error]: error_type: 6, master abort >> | EDAC MC0: 1 CE Master abort on unknown label ( page:0xdead offset:0xbeef >> | grain:-1 syndrome:0x0 - status(0x0000000000000001): reserved) >> >> That 'grain:-1' is because the calculated e->grain was an unlikely 0xffffffffffffffff. >> Patch incoming, if you could test it on your platform that'd be great. >> >> I don't think ghes_edac.c wants this '+1'. > > 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.
Thanks,
James
| |