[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1d2e9514-235e-183e-b4fc-d3becc9ce471@redhat.com>
Date: Mon, 21 Oct 2019 19:27:11 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Anup Patel <Anup.Patel@....com>,
Palmer Dabbelt <palmer@...ive.com>,
Paul Walmsley <paul.walmsley@...ive.com>,
Radim K <rkrcmar@...hat.com>
Cc: Daniel Lezcano <daniel.lezcano@...aro.org>,
Thomas Gleixner <tglx@...utronix.de>,
Alexander Graf <graf@...zon.com>,
Atish Patra <Atish.Patra@....com>,
Alistair Francis <Alistair.Francis@....com>,
Damien Le Moal <Damien.LeMoal@....com>,
Christoph Hellwig <hch@...radead.org>,
Anup Patel <anup@...infault.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v9 20/22] RISC-V: KVM: Fix race-condition in
kvm_riscv_vcpu_sync_interrupts()
On 16/10/19 18:12, Anup Patel wrote:
> + /* Read current VSIP and VSIE CSRs */
> + vsip = csr_read(CSR_VSIP);
> + csr->vsie = csr_read(CSR_VSIE);
> +
> + /* Sync-up VSIP.SSIP bit changes does by Guest */
> + if ((csr->vsip ^ vsip) & (1UL << IRQ_S_SOFT)) {
> + if (!test_and_set_bit(IRQ_S_SOFT, &v->irqs_pending_mask)) {
> + if (vsip & (1UL << IRQ_S_SOFT))
> + set_bit(IRQ_S_SOFT, &v->irqs_pending);
> + else
> + clear_bit(IRQ_S_SOFT, &v->irqs_pending);
> + }
Looks good, but I wonder if this could just be "csr->vsip =
csr_read(CSR_VSIP)", which will be fixed up by flush_interrupts on the
next entry.
Paolo
Powered by blists - more mailing lists