linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Gautam Menghani <gautam@linux.ibm.com>
Cc: npiggin@gmail.com, christophe.leroy@csgroup.eu,
	naveen@kernel.org, maddy@linux.ibm.com,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] arch/powerpc/pseries: Fix KVM guest detection for disabling hardlockup detector
Date: Fri, 08 Nov 2024 10:38:36 +1100	[thread overview]
Message-ID: <87bjyqd37n.fsf@mpe.ellerman.id.au> (raw)
In-Reply-To: <2kkln3emctf7ewsh3eysujid2e7jel7yjtscfxmqeymeo5bjxf@7yzi5eye2n5j>

Gautam Menghani <gautam@linux.ibm.com> writes:
> On Thu, Nov 07, 2024 at 10:54:29PM +1100, Michael Ellerman wrote:
>> Gautam Menghani <gautam@linux.ibm.com> writes:
>> > As per the kernel documentation[1], hardlockup detector should be
>> > disabled in KVM guests as it may give false positives. On PPC, hardlockup
>> > detector is broken inside KVM guests because disable_hardlockup_detector()
>>  
>> Isn't it the opposite? Inside KVM guests, the hardlockup detector should
>> be *disabled*, but it's not it's *enabled*, due to this bug.
>> 
>> ie. it's not broken, it's working, but that's the bug.
>
> Yes right, will change the description in v2.

Thanks.

>> > is marked as early_initcall and it uses is_kvm_guest(), which is
>> > initialized by check_kvm_guest() later during boot as it is a
>> > core_initcall. check_kvm_guest() is also called in pSeries_smp_probe(),
>> > which is called before initcalls, but it is skipped if KVM guest does
>> > not have doorbell support or if the guest is launched with SMT=1.
>> 
>> I'm wondering how no one has noticed. Most KVM guests have SMT=1.
>
> Looking at the commit history, code around hardlockups and
> pSeries_smp_probe() was changed around 2021/2022 timeframe, and I
> believe KVM wasn't being actively tested at the time. 
> Even I noticed this only after coming across the documentation that said
> hardlockups should be disabled. So probably this feature decision isn't
> widely known.

I do test KVM but probably not under enough load to notice something
like that.

>> > Move the check_kvm_guest() call in pSeries_smp_probe() to the initial
>> > part of function before doorbell/SMT checks so that "kvm_guest" static
>> > key is initialized by the time disable_hardlockup_detector() runs.
>> 
>> check_kvm_guest() is safe to be called multiple times so
>> disable_hardlockup_detector() should just call it before it calls
>> is_kvm_guest(). That should avoid future breakage when the order of
>> calls changes, or someone refactors pSeries_smp_probe().
>
> Yeah I did that initially but in the worst case, that results in 3 calls
> to check_kvm_guest() - the core_initcall, pseries_smp_probe() call and 
> then disable_hardlockup_detector(). Will that be fine?

Yeah it's fine. It's not pretty, maybe we can come up with something
cleaner in future, but it's fine for a bug fix.

cheers


      reply	other threads:[~2024-11-07 23:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-05 13:27 [PATCH] arch/powerpc/pseries: Fix KVM guest detection for disabling hardlockup detector Gautam Menghani
2024-11-07 11:54 ` Michael Ellerman
2024-11-07 14:12   ` Gautam Menghani
2024-11-07 23:38     ` Michael Ellerman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bjyqd37n.fsf@mpe.ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=christophe.leroy@csgroup.eu \
    --cc=gautam@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=naveen@kernel.org \
    --cc=npiggin@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).