Re: [PATCH 3/3] KVM: arm/arm64: vgic: Don't rely on the wrong pending table

From: Zenghui Yu
Date: Tue Oct 29 2019 - 09:31:34 EST


Hi Eric,

On 2019/10/29 20:49, Auger Eric wrote:
On 10/29/19 1:27 PM, Zenghui Yu wrote:
okay, the remaining question is that in vgic_v3_save_pending_tables():

ÂÂÂÂstored = val & (1U << bit_nr);
ÂÂÂÂif (stored == irq->pending_latch)
ÂÂÂÂÂÂÂ continue;

ÂÂÂÂif (irq->pending_latch)
ÂÂÂÂÂÂÂ val |= 1 << bit_nr;
ÂÂÂÂelse
ÂÂÂÂÂÂÂ val &= ~(1 << bit_nr);

Do we really have a scenario where irq->pending_latch==false and
stored==true (corresponds to the above "else") and then we clear
pending status of this LPI in guest memory?
I can not think out one now.

if you save, restore and save again. On the 1st save the LPI may be
pending, it gets stored. On the second save the LPI may be not pending
anymore?

I assume you mean the "restore" by vgic_its_restore_ite().

While restoring a LPI, we will sync the pending status from guest
pending table (into the software pending_latch), and clear the
corresponding bit in guest memory.
See vgic_v3_lpi_sync_pending_status().

So on the second save, the LPI can be not pending, the guest pending
table will also indicate not pending.


Thanks,
Zenghui