diff for duplicates of <YWW7zGWUpqXLXE/4@google.com> diff --git a/a/1.txt b/N1/1.txt index 483e313..1f52464 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -3,21 +3,21 @@ On Mon, Oct 11, 2021, Atish Patra wrote: > > On Mon, Oct 11, 2021, Atish Patra wrote: > > > On Fri, 2021-10-08 at 15:02 +0000, Sean Christopherson wrote: > > > > On Thu, Oct 07, 2021, Atish Patra wrote: -> > > > > +???????preempt_disable(); -> > > > > +???????loaded = (vcpu->cpu != -1); -> > > > > +???????if (loaded) -> > > > > +???????????????kvm_arch_vcpu_put(vcpu); +> > > > > + preempt_disable(); +> > > > > + loaded = (vcpu->cpu != -1); +> > > > > + if (loaded) +> > > > > + kvm_arch_vcpu_put(vcpu); > > > > -> > > > Oof.? Looks like this pattern was taken from arm64.? +> > > > Oof. Looks like this pattern was taken from arm64. > > > > > > Yes. This part is similar to arm64 because the same race condition > > > can > > > happen in riscv due to save/restore of CSRs during reset. > > > > > > -> > > > Is there really no better approach to handling this?? I don't see -> > > > anything ?in kvm_riscv_reset_vcpu() that will obviously break if the -> > > > vCPU is ?loaded.? If the goal is purely to effect a CSR reset via +> > > > Is there really no better approach to handling this? I don't see +> > > > anything in kvm_riscv_reset_vcpu() that will obviously break if the +> > > > vCPU is loaded. If the goal is purely to effect a CSR reset via > > > > kvm_arch_vcpu_load(), then why not just factor out a helper to do > > > > exactly that? > > @@ -27,17 +27,17 @@ On Mon, Oct 11, 2021, Atish Patra wrote: More or less. I'm mostly asking why putting the vCPU is necessary. -> > > > > ?void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu) -> > > > > ?{ -> > > > > +???????/** -> > > > > +??????? * vcpu with id 0 is the designated boot cpu. -> > > > > +??????? * Keep all vcpus with non-zero cpu id in power-off +> > > > > void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu) +> > > > > { +> > > > > + /** +> > > > > + * vcpu with id 0 is the designated boot cpu. +> > > > > + * Keep all vcpus with non-zero cpu id in power-off > > > > > state > > > > > so that they -> > > > > +??????? * can brought to online using SBI HSM extension. -> > > > > +??????? */ -> > > > > +???????if (vcpu->vcpu_idx != 0) -> > > > > +???????????????kvm_riscv_vcpu_power_off(vcpu); +> > > > > + * can brought to online using SBI HSM extension. +> > > > > + */ +> > > > > + if (vcpu->vcpu_idx != 0) +> > > > > + kvm_riscv_vcpu_power_off(vcpu); > > > > > > > > Why do this in postcreate? > > > > @@ -48,8 +48,8 @@ More or less. I'm mostly asking why putting the vCPU is necessary. > > > kvm_arch_vcpu_create returns. > > > > But kvm_riscv_vcpu_power_off() doesn't doesn't anything outside of the -> > vCPU.? It clears vcpu->arch.power_off, makes a request, and kicks the -> > vCPU.? None of that has side effects to anything else in KVM.? If the vCPU +> > vCPU. It clears vcpu->arch.power_off, makes a request, and kicks the +> > vCPU. None of that has side effects to anything else in KVM. If the vCPU > > isn't created successfully, it gets deleted and nothing ever sees that > > state change. > @@ -61,3 +61,8 @@ More or less. I'm mostly asking why putting the vCPU is necessary. > after vcpu_idx is assigned. Ah, it's the consumption of vcpu->vcpu_idx that's problematic. Thanks! + +_______________________________________________ +linux-riscv mailing list +linux-riscv@lists.infradead.org +http://lists.infradead.org/mailman/listinfo/linux-riscv diff --git a/a/content_digest b/N1/content_digest index acdc2bd..3b7eeb2 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -5,9 +5,19 @@ "ref\0YWRLBknWXjzPnF1w@google.com\0" "ref\0a762f0263090d7e818e58873d63139d7b6829d87.camel@wdc.com\0" "From\0Sean Christopherson <seanjc@google.com>\0" - "Subject\0[PATCH v3 5/5] RISC-V: Add SBI HSM extension in KVM\0" + "Subject\0Re: [PATCH v3 5/5] RISC-V: Add SBI HSM extension in KVM\0" "Date\0Tue, 12 Oct 2021 16:46:04 +0000\0" - "To\0kvm-riscv@lists.infradead.org\0" + "To\0Atish Patra <Atish.Patra@wdc.com>\0" + "Cc\0kvm-riscv@lists.infradead.org <kvm-riscv@lists.infradead.org>" + linux-riscv@lists.infradead.org <linux-riscv@lists.infradead.org> + vincent.chen@sifive.com <vincent.chen@sifive.com> + Anup Patel <Anup.Patel@wdc.com> + paul.walmsley@sifive.com <paul.walmsley@sifive.com> + palmer@dabbelt.com <palmer@dabbelt.com> + wangkefeng.wang@huawei.com <wangkefeng.wang@huawei.com> + kvm@vger.kernel.org <kvm@vger.kernel.org> + pbonzini@redhat.com <pbonzini@redhat.com> + " linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>\0" "\00:1\0" "b\0" "On Mon, Oct 11, 2021, Atish Patra wrote:\n" @@ -15,21 +25,21 @@ "> > On Mon, Oct 11, 2021, Atish Patra wrote:\n" "> > > On Fri, 2021-10-08 at 15:02 +0000, Sean Christopherson wrote:\n" "> > > > On Thu, Oct 07, 2021, Atish Patra wrote:\n" - "> > > > > +???????preempt_disable();\n" - "> > > > > +???????loaded = (vcpu->cpu != -1);\n" - "> > > > > +???????if (loaded)\n" - "> > > > > +???????????????kvm_arch_vcpu_put(vcpu);\n" + "> > > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240preempt_disable();\n" + "> > > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240loaded = (vcpu->cpu != -1);\n" + "> > > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240if (loaded)\n" + "> > > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240kvm_arch_vcpu_put(vcpu);\n" "> > > > \n" - "> > > > Oof.? Looks like this pattern was taken from arm64.?\n" + "> > > > Oof.\302\240 Looks like this pattern was taken from arm64.\302\240\n" "> > > \n" "> > > Yes. This part is similar to arm64 because the same race condition\n" "> > > can\n" "> > > happen in riscv due to save/restore of CSRs during reset.\n" "> > > \n" "> > > \n" - "> > > > Is there really no better approach to handling this?? I don't see\n" - "> > > > anything ?in kvm_riscv_reset_vcpu() that will obviously break if the\n" - "> > > > vCPU is ?loaded.? If the goal is purely to effect a CSR reset via\n" + "> > > > Is there really no better approach to handling this?\302\240 I don't see\n" + "> > > > anything \302\240in kvm_riscv_reset_vcpu() that will obviously break if the\n" + "> > > > vCPU is \302\240loaded.\302\240 If the goal is purely to effect a CSR reset via\n" "> > > > kvm_arch_vcpu_load(), then why not just factor out a helper to do\n" "> > > > exactly that?\n" "> > \n" @@ -39,17 +49,17 @@ "\n" "More or less. I'm mostly asking why putting the vCPU is necessary.\n" "\n" - "> > > > > ?void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)\n" - "> > > > > ?{\n" - "> > > > > +???????/**\n" - "> > > > > +??????? * vcpu with id 0 is the designated boot cpu.\n" - "> > > > > +??????? * Keep all vcpus with non-zero cpu id in power-off\n" + "> > > > > \302\240void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)\n" + "> > > > > \302\240{\n" + "> > > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240/**\n" + "> > > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 * vcpu with id 0 is the designated boot cpu.\n" + "> > > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 * Keep all vcpus with non-zero cpu id in power-off\n" "> > > > > state\n" "> > > > > so that they\n" - "> > > > > +??????? * can brought to online using SBI HSM extension.\n" - "> > > > > +??????? */\n" - "> > > > > +???????if (vcpu->vcpu_idx != 0)\n" - "> > > > > +???????????????kvm_riscv_vcpu_power_off(vcpu);\n" + "> > > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 * can brought to online using SBI HSM extension.\n" + "> > > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 */\n" + "> > > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240if (vcpu->vcpu_idx != 0)\n" + "> > > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240kvm_riscv_vcpu_power_off(vcpu);\n" "> > > > \n" "> > > > Why do this in postcreate?\n" "> > > > \n" @@ -60,8 +70,8 @@ "> > > kvm_arch_vcpu_create returns.\n" "> > \n" "> > But kvm_riscv_vcpu_power_off() doesn't doesn't anything outside of the\n" - "> > vCPU.? It clears vcpu->arch.power_off, makes a request, and kicks the\n" - "> > vCPU.? None of that has side effects to anything else in KVM.? If the vCPU\n" + "> > vCPU.\302\240 It clears vcpu->arch.power_off, makes a request, and kicks the\n" + "> > vCPU.\302\240 None of that has side effects to anything else in KVM.\302\240 If the vCPU\n" "> > isn't created successfully, it gets deleted and nothing ever sees that\n" "> > state change.\n" "> \n" @@ -72,6 +82,11 @@ "> kvm_vm_ioctl_create_vcpu. kvm_arch_vcpu_postcreate() is the arch hookup\n" "> after vcpu_idx is assigned.\n" "\n" - Ah, it's the consumption of vcpu->vcpu_idx that's problematic. Thanks! + "Ah, it's the consumption of vcpu->vcpu_idx that's problematic. Thanks!\n" + "\n" + "_______________________________________________\n" + "linux-riscv mailing list\n" + "linux-riscv@lists.infradead.org\n" + http://lists.infradead.org/mailman/listinfo/linux-riscv -d7332d83e81889bbd72d040f5862768db8dfc1494596ce714cb061dfa4143dab +e85b374710ea97b57319abaa9fa378635930acc2e7be2a9939e9a6cd09c4cb47
diff --git a/a/1.txt b/N2/1.txt index 483e313..9af77c2 100644 --- a/a/1.txt +++ b/N2/1.txt @@ -3,21 +3,21 @@ On Mon, Oct 11, 2021, Atish Patra wrote: > > On Mon, Oct 11, 2021, Atish Patra wrote: > > > On Fri, 2021-10-08 at 15:02 +0000, Sean Christopherson wrote: > > > > On Thu, Oct 07, 2021, Atish Patra wrote: -> > > > > +???????preempt_disable(); -> > > > > +???????loaded = (vcpu->cpu != -1); -> > > > > +???????if (loaded) -> > > > > +???????????????kvm_arch_vcpu_put(vcpu); +> > > > > + preempt_disable(); +> > > > > + loaded = (vcpu->cpu != -1); +> > > > > + if (loaded) +> > > > > + kvm_arch_vcpu_put(vcpu); > > > > -> > > > Oof.? Looks like this pattern was taken from arm64.? +> > > > Oof. Looks like this pattern was taken from arm64. > > > > > > Yes. This part is similar to arm64 because the same race condition > > > can > > > happen in riscv due to save/restore of CSRs during reset. > > > > > > -> > > > Is there really no better approach to handling this?? I don't see -> > > > anything ?in kvm_riscv_reset_vcpu() that will obviously break if the -> > > > vCPU is ?loaded.? If the goal is purely to effect a CSR reset via +> > > > Is there really no better approach to handling this? I don't see +> > > > anything in kvm_riscv_reset_vcpu() that will obviously break if the +> > > > vCPU is loaded. If the goal is purely to effect a CSR reset via > > > > kvm_arch_vcpu_load(), then why not just factor out a helper to do > > > > exactly that? > > @@ -27,17 +27,17 @@ On Mon, Oct 11, 2021, Atish Patra wrote: More or less. I'm mostly asking why putting the vCPU is necessary. -> > > > > ?void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu) -> > > > > ?{ -> > > > > +???????/** -> > > > > +??????? * vcpu with id 0 is the designated boot cpu. -> > > > > +??????? * Keep all vcpus with non-zero cpu id in power-off +> > > > > void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu) +> > > > > { +> > > > > + /** +> > > > > + * vcpu with id 0 is the designated boot cpu. +> > > > > + * Keep all vcpus with non-zero cpu id in power-off > > > > > state > > > > > so that they -> > > > > +??????? * can brought to online using SBI HSM extension. -> > > > > +??????? */ -> > > > > +???????if (vcpu->vcpu_idx != 0) -> > > > > +???????????????kvm_riscv_vcpu_power_off(vcpu); +> > > > > + * can brought to online using SBI HSM extension. +> > > > > + */ +> > > > > + if (vcpu->vcpu_idx != 0) +> > > > > + kvm_riscv_vcpu_power_off(vcpu); > > > > > > > > Why do this in postcreate? > > > > @@ -48,8 +48,8 @@ More or less. I'm mostly asking why putting the vCPU is necessary. > > > kvm_arch_vcpu_create returns. > > > > But kvm_riscv_vcpu_power_off() doesn't doesn't anything outside of the -> > vCPU.? It clears vcpu->arch.power_off, makes a request, and kicks the -> > vCPU.? None of that has side effects to anything else in KVM.? If the vCPU +> > vCPU. It clears vcpu->arch.power_off, makes a request, and kicks the +> > vCPU. None of that has side effects to anything else in KVM. If the vCPU > > isn't created successfully, it gets deleted and nothing ever sees that > > state change. > diff --git a/a/content_digest b/N2/content_digest index acdc2bd..82f4288 100644 --- a/a/content_digest +++ b/N2/content_digest @@ -5,9 +5,19 @@ "ref\0YWRLBknWXjzPnF1w@google.com\0" "ref\0a762f0263090d7e818e58873d63139d7b6829d87.camel@wdc.com\0" "From\0Sean Christopherson <seanjc@google.com>\0" - "Subject\0[PATCH v3 5/5] RISC-V: Add SBI HSM extension in KVM\0" + "Subject\0Re: [PATCH v3 5/5] RISC-V: Add SBI HSM extension in KVM\0" "Date\0Tue, 12 Oct 2021 16:46:04 +0000\0" - "To\0kvm-riscv@lists.infradead.org\0" + "To\0Atish Patra <Atish.Patra@wdc.com>\0" + "Cc\0kvm-riscv@lists.infradead.org <kvm-riscv@lists.infradead.org>" + linux-riscv@lists.infradead.org <linux-riscv@lists.infradead.org> + vincent.chen@sifive.com <vincent.chen@sifive.com> + Anup Patel <Anup.Patel@wdc.com> + paul.walmsley@sifive.com <paul.walmsley@sifive.com> + palmer@dabbelt.com <palmer@dabbelt.com> + wangkefeng.wang@huawei.com <wangkefeng.wang@huawei.com> + kvm@vger.kernel.org <kvm@vger.kernel.org> + pbonzini@redhat.com <pbonzini@redhat.com> + " linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>\0" "\00:1\0" "b\0" "On Mon, Oct 11, 2021, Atish Patra wrote:\n" @@ -15,21 +25,21 @@ "> > On Mon, Oct 11, 2021, Atish Patra wrote:\n" "> > > On Fri, 2021-10-08 at 15:02 +0000, Sean Christopherson wrote:\n" "> > > > On Thu, Oct 07, 2021, Atish Patra wrote:\n" - "> > > > > +???????preempt_disable();\n" - "> > > > > +???????loaded = (vcpu->cpu != -1);\n" - "> > > > > +???????if (loaded)\n" - "> > > > > +???????????????kvm_arch_vcpu_put(vcpu);\n" + "> > > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240preempt_disable();\n" + "> > > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240loaded = (vcpu->cpu != -1);\n" + "> > > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240if (loaded)\n" + "> > > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240kvm_arch_vcpu_put(vcpu);\n" "> > > > \n" - "> > > > Oof.? Looks like this pattern was taken from arm64.?\n" + "> > > > Oof.\302\240 Looks like this pattern was taken from arm64.\302\240\n" "> > > \n" "> > > Yes. This part is similar to arm64 because the same race condition\n" "> > > can\n" "> > > happen in riscv due to save/restore of CSRs during reset.\n" "> > > \n" "> > > \n" - "> > > > Is there really no better approach to handling this?? I don't see\n" - "> > > > anything ?in kvm_riscv_reset_vcpu() that will obviously break if the\n" - "> > > > vCPU is ?loaded.? If the goal is purely to effect a CSR reset via\n" + "> > > > Is there really no better approach to handling this?\302\240 I don't see\n" + "> > > > anything \302\240in kvm_riscv_reset_vcpu() that will obviously break if the\n" + "> > > > vCPU is \302\240loaded.\302\240 If the goal is purely to effect a CSR reset via\n" "> > > > kvm_arch_vcpu_load(), then why not just factor out a helper to do\n" "> > > > exactly that?\n" "> > \n" @@ -39,17 +49,17 @@ "\n" "More or less. I'm mostly asking why putting the vCPU is necessary.\n" "\n" - "> > > > > ?void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)\n" - "> > > > > ?{\n" - "> > > > > +???????/**\n" - "> > > > > +??????? * vcpu with id 0 is the designated boot cpu.\n" - "> > > > > +??????? * Keep all vcpus with non-zero cpu id in power-off\n" + "> > > > > \302\240void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)\n" + "> > > > > \302\240{\n" + "> > > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240/**\n" + "> > > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 * vcpu with id 0 is the designated boot cpu.\n" + "> > > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 * Keep all vcpus with non-zero cpu id in power-off\n" "> > > > > state\n" "> > > > > so that they\n" - "> > > > > +??????? * can brought to online using SBI HSM extension.\n" - "> > > > > +??????? */\n" - "> > > > > +???????if (vcpu->vcpu_idx != 0)\n" - "> > > > > +???????????????kvm_riscv_vcpu_power_off(vcpu);\n" + "> > > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 * can brought to online using SBI HSM extension.\n" + "> > > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240 */\n" + "> > > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240if (vcpu->vcpu_idx != 0)\n" + "> > > > > +\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240\302\240kvm_riscv_vcpu_power_off(vcpu);\n" "> > > > \n" "> > > > Why do this in postcreate?\n" "> > > > \n" @@ -60,8 +70,8 @@ "> > > kvm_arch_vcpu_create returns.\n" "> > \n" "> > But kvm_riscv_vcpu_power_off() doesn't doesn't anything outside of the\n" - "> > vCPU.? It clears vcpu->arch.power_off, makes a request, and kicks the\n" - "> > vCPU.? None of that has side effects to anything else in KVM.? If the vCPU\n" + "> > vCPU.\302\240 It clears vcpu->arch.power_off, makes a request, and kicks the\n" + "> > vCPU.\302\240 None of that has side effects to anything else in KVM.\302\240 If the vCPU\n" "> > isn't created successfully, it gets deleted and nothing ever sees that\n" "> > state change.\n" "> \n" @@ -74,4 +84,4 @@ "\n" Ah, it's the consumption of vcpu->vcpu_idx that's problematic. Thanks! -d7332d83e81889bbd72d040f5862768db8dfc1494596ce714cb061dfa4143dab +fc7f1def29e378bb5d66934501429083451712c33c736f243bd1adc37273e1e8
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.