From: Marc Zyngier <marc.zyngier@arm.com>
To: Christoffer Dall <christoffer.dall@linaro.org>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"kvmarm@lists.cs.columbia.edu" <kvmarm@lists.cs.columbia.edu>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"Eric Auger" <eric.auger@linaro.org>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Andre Przywara" <Andre.Przywara@arm.com>
Subject: Re: [PATCH v3 06/11] KVM: arm/arm64: vgic: Allow dynamic mapping of physical/virtual interrupts
Date: Tue, 04 Aug 2015 19:10:55 +0100 [thread overview]
Message-ID: <55C1002F.6070801@arm.com> (raw)
In-Reply-To: <20150804173650.GG29335@cbox>
On 04/08/15 18:36, Christoffer Dall wrote:
> On Tue, Aug 04, 2015 at 04:27:03PM +0100, Marc Zyngier wrote:
>> On 04/08/15 14:04, Christoffer Dall wrote:
>>> On Fri, Jul 24, 2015 at 04:55:04PM +0100, Marc Zyngier wrote:
>>>> In order to be able to feed physical interrupts to a guest, we need
>>>> to be able to establish the virtual-physical mapping between the two
>>>> worlds.
>>>>
>>>> The mappings are kept in a set of RCU lists, indexed by virtual interrupts.
>>>>
>>>> Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
>>>> ---
>>>> arch/arm/kvm/arm.c | 2 +
>>>> include/kvm/arm_vgic.h | 26 +++++++
>>>> virt/kvm/arm/vgic.c | 189 ++++++++++++++++++++++++++++++++++++++++++++++++-
>>>> 3 files changed, 216 insertions(+), 1 deletion(-)
>>>>
[...]
>>>> +/**
>>>> + * kvm_vgic_unmap_phys_irq - Remove a virtual to physical IRQ mapping
>>>> + * @vcpu: The VCPU pointer
>>>> + * @map: The pointer to a mapping obtained through kvm_vgic_map_phys_irq
>>>> + *
>>>> + * Remove an existing mapping between virtual and physical interrupts.
>>>> + */
>>>> +int kvm_vgic_unmap_phys_irq(struct kvm_vcpu *vcpu, struct irq_phys_map *map)
>>>> +{
>>>> + struct vgic_dist *dist = &vcpu->kvm->arch.vgic;
>>>> + struct irq_phys_map_entry *entry;
>>>> + struct list_head *root;
>>>> +
>>>> + if (!map)
>>>> + return -EINVAL;
>>>> +
>>>> + root = vgic_get_irq_phys_map_list(vcpu, map->virt_irq);
>>>> +
>>>> + spin_lock(&dist->irq_phys_map_lock);
>>>> +
>>>> + list_for_each_entry(entry, root, entry) {
>>>> + if (&entry->map == map && !map->deleted) {
>>>> + map->deleted = true;
>>>
>>> why do you need the 'deleted' flag? You now search the list only after
>>> holding the lock, so the race I pointed out before doesn't exist
>>> anymore. Is there an additional issue that the deleted flag is taking
>>> care of?
>>
>> This could still race with a destroy occuring before we take the lock,
>> and before we get get RCU to do the cleanup (the list would still be
>> populated).
>>
>
> That's not how I understand list_del_rcu; I think it deletes the entry
> immediately with the right memory barriers. It is only the free
> operation that happens on rcu sync and can be/is deferred.
Indeed. I stupidly though the two were deferred, but reading the code
definitely confirmed your point. I'll get rid of the delete stuff.
Thanks,
M.
--
Jazz is not dead. It just smells funny...
next prev parent reply other threads:[~2015-08-04 18:10 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-24 15:54 [PATCH v3 00/11] arm/arm64: KVM: Active interrupt state switching for shared devices Marc Zyngier
2015-07-24 15:54 ` [PATCH v3 01/11] arm/arm64: KVM: Fix ordering of timer/GIC on guest entry Marc Zyngier
2015-07-24 15:55 ` [PATCH v3 02/11] arm/arm64: KVM: Move vgic handling to a non-preemptible section Marc Zyngier
2015-07-24 15:55 ` [PATCH v3 03/11] KVM: arm/arm64: vgic: Convert struct vgic_lr to use bitfields Marc Zyngier
2015-07-24 15:55 ` [PATCH v3 04/11] KVM: arm/arm64: vgic: Allow HW irq to be encoded in LR Marc Zyngier
2015-08-04 14:33 ` Christoffer Dall
2015-07-24 15:55 ` [PATCH v3 05/11] KVM: arm/arm64: vgic: Relax vgic_can_sample_irq for edge IRQs Marc Zyngier
2015-07-24 15:55 ` [PATCH v3 06/11] KVM: arm/arm64: vgic: Allow dynamic mapping of physical/virtual interrupts Marc Zyngier
2015-08-04 13:04 ` Christoffer Dall
2015-08-04 15:27 ` Marc Zyngier
2015-08-04 17:36 ` Christoffer Dall
2015-08-04 18:10 ` Marc Zyngier [this message]
2015-07-24 15:55 ` [PATCH v3 07/11] KVM: arm/arm64: vgic: Allow HW interrupts to be queued to a guest Marc Zyngier
2015-08-04 14:33 ` Christoffer Dall
2015-07-24 15:55 ` [PATCH v3 08/11] KVM: arm/arm64: vgic: Add vgic_{get,set}_phys_irq_active Marc Zyngier
2015-07-24 15:55 ` [PATCH v3 09/11] KVM: arm/arm64: vgic: Prevent userspace injection of a mapped interrupt Marc Zyngier
2015-08-04 13:45 ` Christoffer Dall
2015-08-04 16:02 ` Marc Zyngier
2015-08-04 17:38 ` Christoffer Dall
2015-08-04 16:21 ` Eric Auger
2015-08-04 16:44 ` Marc Zyngier
2015-08-05 7:32 ` Eric Auger
2015-08-05 9:44 ` Marc Zyngier
2015-08-05 10:53 ` Christoffer Dall
2015-08-05 11:47 ` Eric Auger
2015-08-05 13:47 ` Christoffer Dall
2015-08-06 16:44 ` Marc Zyngier
2015-08-07 7:05 ` Eric Auger
2015-08-07 8:29 ` Marc Zyngier
2015-07-24 15:55 ` [PATCH v3 10/11] KVM: arm/arm64: timer: Allow the timer to control the active state Marc Zyngier
2015-08-04 13:56 ` Christoffer Dall
2015-08-04 16:14 ` Marc Zyngier
2015-08-04 17:40 ` Christoffer Dall
2015-07-24 15:55 ` [PATCH v3 11/11] KVM: arm/arm64: vgic: Allow HW interrupts for non-shared devices Marc Zyngier
2015-08-04 14:32 ` Christoffer Dall
2015-08-04 17:08 ` Marc Zyngier
2015-08-04 18:07 ` Christoffer Dall
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=55C1002F.6070801@arm.com \
--to=marc.zyngier@arm.com \
--cc=Andre.Przywara@arm.com \
--cc=alex.bennee@linaro.org \
--cc=christoffer.dall@linaro.org \
--cc=eric.auger@linaro.org \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=linux-arm-kernel@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).