mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Zigotzky <chzigotzky@xenosoft.de>
To: "Ritesh Harjani (IBM)" <ritesh.list@gmail.com>,
	Shrikanth Hegde <sshegde@linux.ibm.com>,
	Narayana Murty N <nnmlinux@linux.ibm.com>,
	maddy@linux.ibm.com, linuxppc-dev@lists.ozlabs.org
Cc: mpe@ellerman.id.au, npiggin@gmail.com,
	christophe.leroy@csgroup.eu, linux-kernel@vger.kernel.org,
	msuchanek@suse.de, harshpb@linux.ibm.com, gautam@linux.ibm.com,
	amachhiw@linux.ibm.com, venkat88@linux.ibm.com,
	"R.T.Dickinson" <rtd2@xtra.co.nz>,
	mad skateman <madskateman@gmail.com>,
	Damien Stewart <hypexed@yahoo.com.au>
Subject: Re: [PATCH 1/2] KVM: PPC: BookE: Disable preemption before loading guest FP and Altivec
Date: Sun, 1 Nov 2026 09:28:50 +0100	[thread overview]
Message-ID: <15075ad5-73f8-4714-0503-2565ca3dfb4b@xenosoft.de> (raw)
In-Reply-To: <33tnw44q.ritesh.list@gmail.com>

On 30/10/26 17:21, Ritesh Harjani (IBM) wrote:
> Shrikanth Hegde <sshegde@linux.ibm.com> writes:
>
>> Hi Narayana.
>>
>> On 10/1/26 4:56 PM, Narayana Murty N wrote:
>>> Hi Shrikanth,
>>> Thanks for the fixes. I had one question on patch 1.
>> See response below.
>>
>>>> diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
>>>> index 13ad4cf5fa71..5b9118eefe1d 100644
>>>> --- a/arch/powerpc/kvm/booke.c
>>>> +++ b/arch/powerpc/kvm/booke.c
>>>> @@ -1404,10 +1404,17 @@ int kvmppc_handle_exit(struct kvm_vcpu *vcpu, unsigned int exit_nr)
>>>>            if (s <= 0)
>>>>                r = (s << 2) | RESUME_HOST | (r & RESUME_FLAG_NV);
>>>>            else {
>>>> -            /* interrupts now hard-disabled */
>>>> +            /*
>>>> +             * kvmppc_fix_ee_before_entry() marks the software
>>>> +             * IRQ state enabled while interrupts are still
>>>> +             * hard-disabled. So disable preemption while loading
>>>> +             * guest FP and Altivec.
>>>> +             */
>>>>                kvmppc_fix_ee_before_entry();
>>>> +            preempt_disable();
>>>>                kvmppc_load_guest_fp(vcpu);
>>>>                kvmppc_load_guest_altivec(vcpu);
>>>> +            preempt_enable_no_resched();
>>> Would it be simpler to move kvmppc_fix_ee_before_entry() after the
>>> FP/Altivec loads instead?
>>>
>>> The normal kvmppc_vcpu_run() entry path already loads the guest
>>> FP/Altivec state while interrupts are still disabled and calls
>>> kvmppc_fix_ee_before_entry() immediately before entering the guest.
>>>
>>> So could this path follow the same ordering:
>>>
>>> kvmppc_load_guest_fp(vcpu);
>>> kvmppc_load_guest_altivec(vcpu);
>>> kvmppc_fix_ee_before_entry();
>>>
> Thanks Narayana, that actually make more sense to me.
>
>
>>> That would avoid making the software IRQ state enabled before loading
>>> the guest FP/Altivec state, and also avoid the additional
>>> preempt_disable()/preempt_enable_no_resched() pair.
>>>
>>> Thanks,
>>> Narayana Murty.
>>>>            }
>>>>        }
>> I thought I had put that for discussion after ---, but looks like I forgot.
>>
>> I don't mind the above too.  but I didn't have a way to test it.
> Actually I agree with Narayan's reasoning here.
>
> Sorry for being so late to the game. As you know we have been occupied
> with other things internally.
>
>> So kept it as is based on what Christian said works for him.
>> If you have a way to test the patches, please let me know.
>> We can try that too.
> Let's ask Christian directly :)
> @Christian - Once we have v2, would you kindly help us test that
> please?
>
> We think the other approach which Narayana suggested might be a better
> fix for this and it can avoid preempt_enable/disable() dance. However,
> looks like we may not have the board where we can reproduce this.
>
>
> -ritesh
>

Yes, I can help with testing.

- Christian

-- 
Sent with BrassMonkey 35.0.2 (https://github.com/chzigotzky/Web-Browsers-and-Suites-for-Linux-PPC/releases/tag/BrassMonkey_35.0.2)


  reply	other threads:[~2026-11-01  8:29 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-28 11:04 [PATCH 0/2] KVM: PPC: BookE: Fix boot hang on preemptible kernels Shrikanth Hegde
2026-09-28 11:04 ` [PATCH 1/2] KVM: PPC: BookE: Disable preemption before loading guest FP and Altivec Shrikanth Hegde
2026-10-01 11:26   ` Narayana Murty N
2026-10-01 11:53     ` Shrikanth Hegde
2026-10-30 16:21       ` Ritesh Harjani
2026-11-01  8:28         ` Christian Zigotzky [this message]
2026-11-01 11:35         ` [PATCH] powerpc/pasemi: Defer Nemo IRQ initialization Christian Zigotzky
2026-09-28 11:04 ` [PATCH 2/2] KVM: PPC: Replay pending interrupts before entering the guest Shrikanth Hegde
2026-10-01 11:28   ` Narayana Murty N
2026-10-01 11:57     ` Shrikanth Hegde
2026-10-06 15:37   ` Gautam Menghani
2026-10-30 16:30   ` Ritesh Harjani
2026-09-29 15:51 ` [PATCH 0/2] KVM: PPC: BookE: Fix boot hang on preemptible kernels Christian Zigotzky
2026-10-22 16:42   ` Christian Zigotzky

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=15075ad5-73f8-4714-0503-2565ca3dfb4b@xenosoft.de \
    --to=chzigotzky@xenosoft.de \
    --cc=amachhiw@linux.ibm.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=gautam@linux.ibm.com \
    --cc=harshpb@linux.ibm.com \
    --cc=hypexed@yahoo.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=madskateman@gmail.com \
    --cc=mpe@ellerman.id.au \
    --cc=msuchanek@suse.de \
    --cc=nnmlinux@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=ritesh.list@gmail.com \
    --cc=rtd2@xtra.co.nz \
    --cc=sshegde@linux.ibm.com \
    --cc=venkat88@linux.ibm.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

all inboxes | Powered by JetHome®