[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 3/6] cputlb: ensure we save the IOTLB data in case of rese
From: |
Emilio G. Cota |
Subject: |
Re: [PATCH v2 3/6] cputlb: ensure we save the IOTLB data in case of reset |
Date: |
Mon, 22 Jun 2020 21:54:26 -0400 |
On Mon, Jun 22, 2020 at 10:02:50 +0100, Alex Bennée wrote:
> Emilio G. Cota <cota@braap.org> writes:
> > On Wed, Jun 10, 2020 at 16:55:06 +0100, Alex Bennée wrote:
(snip)
> >> +#ifdef CONFIG_PLUGIN
> >> +
> >> +typedef struct SavedIOTLB {
> >> + struct rcu_head rcu;
> >> + struct SavedIOTLB **save_loc;
> >> + MemoryRegionSection *section;
> >> + hwaddr mr_offset;
> >> +} SavedIOTLB;
> >> +
> >> +static void clean_saved_entry(SavedIOTLB *s)
> >> +{
> >> + atomic_rcu_set(s->save_loc, NULL);
> >
> > This will race with the CPU thread that sets saved_for_plugin in
> > save_iotlb_data().
>
> Surely that only happens outside the critical section?
I am not sure which critical section you're referring to.
With call_rcu() we defer the execution of the function to the RCU
thread at a later time, where "later time" is defined as any time
after the pre-existing RCU read critical sections have elapsed.
So we could have the RCU thread clearing the variable while the
CPU thread, which is in a _later_ RCU read critical section, is
setting said variable. This is the race I was referring to.
Thanks,
Emilio
- [PATCH v2 0/6] plugins/next (lockstep, api, hwprofile), Alex Bennée, 2020/06/10
- [PATCH v2 1/6] iotests: 194: wait migration completion on target too, Alex Bennée, 2020/06/10
- [PATCH v2 4/6] hw/virtio/pci: include vdev name in registered PCI sections, Alex Bennée, 2020/06/10
- [PATCH v2 2/6] plugins: new lockstep plugin for debugging TCG changes, Alex Bennée, 2020/06/10
- [PATCH v2 5/6] plugins: add API to return a name for a IO device, Alex Bennée, 2020/06/10
- [PATCH v2 6/6] plugins: new hwprofile plugin, Alex Bennée, 2020/06/10