[PATCH v3] powerpc: setup_64: set up PACA earlier to avoid kcov problems

Nicholas Piggin npiggin at gmail.com
Sat Mar 14 14:37:15 AEDT 2020


Daniel Axtens's on March 11, 2020 9:03 am:
>>>> So:
>>>>  - change the test when setting up a PACA to consider the actual value of
>>>>    the MSR rather than the CPU feature.
>>>> 
>>>>  - move the PACA setup to before the cpu feature parsing.
>>>
>>> Hmm. Problem is that equally we want PACA to be sane before we call too
>>> far into the rest of the kernel ("generic dt parsing code").
>>
>> But currently we call into that code with no paca at all. Or rather,
>> with r13 pointing somewhere random that will be interpreted as being a
>> paca.
>>
>> This took a while for Daniel to debug because depending on how you boot
>> r13 contains a different junk value. That junk value may not point to
>> memory at all, or if it does the memory it points to may or may not send
>> you down the wrong path, depending on which exact bit you're looking at
>> in some random location.
>>
>> So this is really not about kcov from my POV, that's just how we
>> discovered it.
> 
> Ah, yes. I agree with mpe, and reading back over my commit message I
> think I did a pretty poor job of explaining it. How about this for a
> commit message:

Sorry yeah I'm not quite sure what I was thinking there, because
you actually are moving the paca setup earlier. Hmm. Anyway it seems
okay to me. I would suggest putting a comment in the mfmsr() & MSR_HV
test so it doesn't get used elsewhere. Maybe include CPU_FTR_HVMODE
in the comment so grep shows it up.

Thanks,
Nick


More information about the Linuxppc-dev mailing list