From: Fabiano Rosas <farosas@linux.ibm.com>
To: Nicholas Piggin <npiggin@gmail.com>, kvm-ppc@vger.kernel.org
Cc: aik@ozlabs.ru, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 2/3] KVM: PPC: Book3S HV: Delay setting of kvm ops
Date: Tue, 11 Jan 2022 14:43:23 +0000 [thread overview]
Message-ID: <87lezm8h9w.fsf@linux.ibm.com> (raw)
In-Reply-To: <1640427464.ji8lnut0io.astroid@bobo.none>
Nicholas Piggin <npiggin@gmail.com> writes:
> Excerpts from Fabiano Rosas's message of December 24, 2021 7:19 am:
>> Delay the setting of kvm_hv_ops until after all init code has
>> completed. This avoids leaving the ops still accessible if the init
>> fails.
>>
>> Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
>> ---
>> arch/powerpc/kvm/book3s_hv.c | 12 +++++++-----
>> 1 file changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
>> index 9f4765951733..53400932f5d8 100644
>> --- a/arch/powerpc/kvm/book3s_hv.c
>> +++ b/arch/powerpc/kvm/book3s_hv.c
>> @@ -6087,9 +6087,6 @@ static int kvmppc_book3s_init_hv(void)
>> }
>> #endif
>>
>> - kvm_ops_hv.owner = THIS_MODULE;
>> - kvmppc_hv_ops = &kvm_ops_hv;
>> -
>> init_default_hcalls();
>>
>> init_vcore_lists();
>> @@ -6105,10 +6102,15 @@ static int kvmppc_book3s_init_hv(void)
>> }
>>
>> r = kvmppc_uvmem_init();
>> - if (r < 0)
>> + if (r < 0) {
>> pr_err("KVM-HV: kvmppc_uvmem_init failed %d\n", r);
>> + return r;
>> + }
>>
>> - return r;
>> + kvm_ops_hv.owner = THIS_MODULE;
>> + kvmppc_hv_ops = &kvm_ops_hv;
>> +
>> + return 0;
>> }
>>
>> static void kvmppc_book3s_exit_hv(void)
>> --
>> 2.33.1
>>
>>
>
> Also looks okay to me but KVM init has lots of details. IIRC Alexey may
> have run into a related issue with ops being set too early (or was it
> cleared too late?)
>
> Thanks,
> Nick
>
CC Alexey
WARNING: multiple messages have this Message-ID (diff)
From: Fabiano Rosas <farosas@linux.ibm.com>
To: Nicholas Piggin <npiggin@gmail.com>, kvm-ppc@vger.kernel.org
Cc: aik@ozlabs.ru, linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH 2/3] KVM: PPC: Book3S HV: Delay setting of kvm ops
Date: Tue, 11 Jan 2022 11:43:23 -0300 [thread overview]
Message-ID: <87lezm8h9w.fsf@linux.ibm.com> (raw)
In-Reply-To: <1640427464.ji8lnut0io.astroid@bobo.none>
Nicholas Piggin <npiggin@gmail.com> writes:
> Excerpts from Fabiano Rosas's message of December 24, 2021 7:19 am:
>> Delay the setting of kvm_hv_ops until after all init code has
>> completed. This avoids leaving the ops still accessible if the init
>> fails.
>>
>> Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
>> ---
>> arch/powerpc/kvm/book3s_hv.c | 12 +++++++-----
>> 1 file changed, 7 insertions(+), 5 deletions(-)
>>
>> diff --git a/arch/powerpc/kvm/book3s_hv.c b/arch/powerpc/kvm/book3s_hv.c
>> index 9f4765951733..53400932f5d8 100644
>> --- a/arch/powerpc/kvm/book3s_hv.c
>> +++ b/arch/powerpc/kvm/book3s_hv.c
>> @@ -6087,9 +6087,6 @@ static int kvmppc_book3s_init_hv(void)
>> }
>> #endif
>>
>> - kvm_ops_hv.owner = THIS_MODULE;
>> - kvmppc_hv_ops = &kvm_ops_hv;
>> -
>> init_default_hcalls();
>>
>> init_vcore_lists();
>> @@ -6105,10 +6102,15 @@ static int kvmppc_book3s_init_hv(void)
>> }
>>
>> r = kvmppc_uvmem_init();
>> - if (r < 0)
>> + if (r < 0) {
>> pr_err("KVM-HV: kvmppc_uvmem_init failed %d\n", r);
>> + return r;
>> + }
>>
>> - return r;
>> + kvm_ops_hv.owner = THIS_MODULE;
>> + kvmppc_hv_ops = &kvm_ops_hv;
>> +
>> + return 0;
>> }
>>
>> static void kvmppc_book3s_exit_hv(void)
>> --
>> 2.33.1
>>
>>
>
> Also looks okay to me but KVM init has lots of details. IIRC Alexey may
> have run into a related issue with ops being set too early (or was it
> cleared too late?)
>
> Thanks,
> Nick
>
CC Alexey
next prev parent reply other threads:[~2022-01-11 14:43 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-23 21:19 [PATCH 0/3] KVM: PPC: KVM module exit fixes Fabiano Rosas
2021-12-23 21:19 ` Fabiano Rosas
2021-12-23 21:19 ` [PATCH 1/3] KVM: PPC: Book3S HV: Check return value of kvmppc_radix_init Fabiano Rosas
2021-12-23 21:19 ` Fabiano Rosas
2021-12-25 10:17 ` Nicholas Piggin
2021-12-25 10:17 ` Nicholas Piggin
2021-12-23 21:19 ` [PATCH 2/3] KVM: PPC: Book3S HV: Delay setting of kvm ops Fabiano Rosas
2021-12-23 21:19 ` Fabiano Rosas
2021-12-25 10:19 ` Nicholas Piggin
2021-12-25 10:19 ` Nicholas Piggin
2022-01-11 14:43 ` Fabiano Rosas [this message]
2022-01-11 14:43 ` Fabiano Rosas
2021-12-23 21:19 ` [PATCH 3/3] KVM: PPC: Book3S HV: Free allocated memory if module init fails Fabiano Rosas
2021-12-23 21:19 ` Fabiano Rosas
2021-12-25 10:22 ` Nicholas Piggin
2021-12-25 10:22 ` Nicholas Piggin
2022-02-18 2:09 ` [PATCH 0/3] KVM: PPC: KVM module exit fixes Michael Ellerman
2022-02-18 2:09 ` Michael Ellerman
2022-03-12 10:42 ` Michael Ellerman
2022-03-12 10:42 ` Michael Ellerman
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=87lezm8h9w.fsf@linux.ibm.com \
--to=farosas@linux.ibm.com \
--cc=aik@ozlabs.ru \
--cc=kvm-ppc@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.