Re: [PATCH v6 00/12] SVM cleanup and INVPCID feature support

Babu Moger
2021-03-11T20:57:50Z

On 3/11/21 2:32 PM, Borislav Petkov wrote:
> On Thu, Mar 11, 2021 at 09:07:55PM +0100, Borislav Petkov wrote:
>> On Wed, Mar 10, 2021 at 07:21:23PM -0600, Babu Moger wrote:
>>> # git bisect good
>>> 59094faf3f618b2d2b2a45acb916437d611cede6 is the first bad commit
>>> commit 59094faf3f618b2d2b2a45acb916437d611cede6
>>> Author: Borislav Petkov <bp@suse.de>
>>> Date: Mon Dec 25 13:57:16 2017 +0100
>>>
>>> x86/kaiser: Move feature detection up
>>
>> What is the reproducer?
>>
>> Boot latest 4.9 stable kernel in a SEV guest? Can you send guest
>> .config?
>>
>> Upthread is talking about PCID, so I'm guessing host needs to be Zen3
>> with PCID. Anything else?
>
> That oops points to:
>
> [ 1.237515] kernel BUG at /build/linux-dqnRSc/linux-4.9.228/arch/x86/kernel/alternative.c:709!
>
> which is:
>
> local_flush_tlb();
> sync_core();
> /* Could also do a CLFLUSH here to speed up CPU recovery; but
> that causes hangs on some VIA CPUs. */
> for (i = 0; i < len; i++)
> BUG_ON(((char *)addr)[i] != ((char *)opcode)[i]); <---
> local_irq_restore(flags);
> return addr;
>
> in text_poke() which basically says that the patching verification
> fails. And you have a local_flush_tlb() before that. And with PCID maybe
> it is not flushing properly or whatnot.
>
> And deep down in the TLB flushing code, it does:
>
> if (kaiser_enabled)
> kaiser_flush_tlb_on_return_to_user();
>
> and that uses PCID...
>
> Anyway, needs more info.

Boris,
It is related PCID and INVPCID combination. Few more details.
1. System comes up fine with "noinvpid". So, it happens when invpcid is
enabled.
2. Host is coming up fine. Problem is with the guest.
3. Problem happens with Debian 9. Debian kernel version is 4.9.0-14.
4. Debian 10 is fine.
5. Upstream kernels are fine. Tried on v5.11 and it is working fine.
6. Git bisect pointed to commit 47811c66356d875e76a6ca637a9d384779a659bb.

Let me know if want me to try something else.
thanks
Babu