lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 2 Dec 2019 10:02:38 +0000
From:   John Garry <john.garry@...wei.com>
To:     Cong Wang <xiyou.wangcong@...il.com>
CC:     <iommu@...ts.linux-foundation.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [Patch v2 2/3] iommu: optimize iova_magazine_free_pfns()

On 30/11/2019 06:02, Cong Wang wrote:
> On Fri, Nov 29, 2019 at 5:24 AM John Garry <john.garry@...wei.com> wrote:
>>
>> On 29/11/2019 00:48, Cong Wang wrote:
>>> If the maganize is empty, iova_magazine_free_pfns() should
>>
>> magazine
> 
> Good catch!
> 
>>
>>> be a nop, however it misses the case of mag->size==0. So we
>>> should just call iova_magazine_empty().
>>>
>>> This should reduce the contention on iovad->iova_rbtree_lock
>>> a little bit.
>>>
>>> Cc: Joerg Roedel <joro@...tes.org>
>>> Signed-off-by: Cong Wang <xiyou.wangcong@...il.com>
>>> ---
>>>    drivers/iommu/iova.c | 22 +++++++++++-----------
>>>    1 file changed, 11 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/drivers/iommu/iova.c b/drivers/iommu/iova.c
>>> index cb473ddce4cf..184d4c0e20b5 100644
>>> --- a/drivers/iommu/iova.c
>>> +++ b/drivers/iommu/iova.c
>>> @@ -797,13 +797,23 @@ static void iova_magazine_free(struct iova_magazine *mag)
>>>        kfree(mag);
>>>    }
>>>
>>> +static bool iova_magazine_full(struct iova_magazine *mag)
>>> +{
>>> +     return (mag && mag->size == IOVA_MAG_SIZE);
>>> +}
>>> +
>>> +static bool iova_magazine_empty(struct iova_magazine *mag)
>>> +{
>>> +     return (!mag || mag->size == 0);
>>> +}
>>> +
>>>    static void
>>>    iova_magazine_free_pfns(struct iova_magazine *mag, struct iova_domain *iovad)
>>>    {
>>>        unsigned long flags;
>>>        int i;
>>>
>>> -     if (!mag)
>>> +     if (iova_magazine_empty(mag))
>>
>> The only hot path we this call is
>> __iova_rcache_insert()->iova_magazine_free_pfns(mag_to_free) and
>> mag_to_free is full in this case, so I am sure how the additional check
>> helps, right?
> 
> This is what I mean by "a little bit" in changelog, did you miss it or
> misunderstand it? :)

I was concerned that in the fastpath we actually make things very 
marginally slower by adding a check which will fail.

Thanks,
John

> 
> Thanks.
> .
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ