[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH] arm/vgic-v3: provide custom callbacks for pend_lpi_tree radix tree
- To: Julien Grall <julien@xxxxxxx>
- From: Luca Fancellu <luca.fancellu@xxxxxxx>
- Date: Fri, 11 Feb 2022 15:45:06 +0000
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Vnyqr+qWkFjFNmaWaLvScoHCIQEIOKeGAKRi94FpXhI=; b=TYI1bbtstGM1vVUaSScwKZ14Lb3a92oe6gm/RcPymV+cmkGED7/+xeqStnm3k9BkbtrGjYneIl9/nj/PZZOgT1UT3BrHzQ5yAVCdXjPki7bJUC45lBO9h3b+iA74gYbvRxVDo8/PfrdUspzDQ/nh3PGZN6PRHheFnnF3B/xqc2N+8q3rDlC4UfgPypS6SG9oRU3p1CNPH3NIBG61m9sGB9Idd9Gk2lCmWHSkpGgQkjxqcKw2QpEFyFnid7Eb5dPXBVNN43IBvWNfOGmZa/331kSUHiDdxpznXizYVPEf/h34kRPziBGvoTvUWxtKmq1fAg+25l0K9WbQjG5d4dzVrg==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=amtLo3Y0G2m0PjIteIHjTBDbBr6Qc8LXjA1LQOMy+8Jv20ObLowWW0pK7EtYbevP5dgTzkHRf1Bz47ES7NkfzzW45gpxdKOr+tndPjcrfvV8WmHwpvpbaYhjkrV8sXcEZCP9FaeDUqCrZb+E1ylfeCA/FOLgQ4h4FEdJ1dzu+WnVuP+ukeEpDOqIxglQuUtHL/upM3Fjgthm9U7VVPn6RhjpXj59fmDL+Eu3XW+A/5cxEvjiKoM2fxj9q2/y8IvP+0eMSZ2HSIhNjPBtwd6dr3F84sEqdafEMip5lNLZ1u6NaXorFBKPNwFhv+8+cJ7cdfPSdw4nouCNC7Ex+djTMA==
- Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
- Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, wei.chen@xxxxxxx, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>
- Delivery-date: Fri, 11 Feb 2022 15:45:34 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Nodisclaimer: true
- Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
> On 11 Feb 2022, at 15:26, Julien Grall <julien@xxxxxxx> wrote:
>
> Hi Luca,
>
> On 11/02/2022 15:00, Luca Fancellu wrote:
>> pend_lpi_tree is a radix tree used to store pending irqs, the tree is
>> protected by a lock for read/write operations.
>> Currently the radix tree default function to free items uses the
>> RCU mechanism, calling call_rcu and deferring the operation.
>> However every access to the structure is protected by the lock so we
>> can avoid using the default free function that, by using RCU,
>> increases memory usage and impacts the predictability of the system.
>
> I understand goal but looking at the implementation of
> vgic_v3_lpi_to_pending() (Copied below for convenience). We would release the
> lock as soon as the look-up finish, yet the element is returned.
>
> static struct pending_irq *vgic_v3_lpi_to_pending(struct domain *d,
> unsigned int lpi)
> {
> struct pending_irq *pirq;
>
> read_lock(&d->arch.vgic.pend_lpi_tree_lock);
> pirq = radix_tree_lookup(&d->arch.vgic.pend_lpi_tree, lpi);
> read_unlock(&d->arch.vgic.pend_lpi_tree_lock);
>
> return pirq;
> }
>
> So the lock will not protect us against removal. If you want to drop the RCU,
> you will need to ensure the structure pending_irq is suitably protected. I
> haven't check whether there are other locks that may suit us here.
>
Hi Julien,
Yes you are right! I missed that, sorry for the noise.
Cheers,
Luca
> Cheers,
>
> --
> Julien Grall
|