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]
Message-ID: <1ea7a0d2-e640-4549-ac0e-8ae0df8d8e6a@redhat.com>
Date: Fri, 2 Aug 2024 17:57:46 +0200
From: David Hildenbrand <david@...hat.com>
To: James Houghton <jthoughton@...gle.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
 Paolo Bonzini <pbonzini@...hat.com>, Ankit Agrawal <ankita@...dia.com>,
 Axel Rasmussen <axelrasmussen@...gle.com>,
 Catalin Marinas <catalin.marinas@....com>,
 David Matlack <dmatlack@...gle.com>, David Rientjes <rientjes@...gle.com>,
 James Morse <james.morse@....com>, Jason Gunthorpe <jgg@...pe.ca>,
 Jonathan Corbet <corbet@....net>, Marc Zyngier <maz@...nel.org>,
 Oliver Upton <oliver.upton@...ux.dev>,
 Raghavendra Rao Ananta <rananta@...gle.com>,
 Ryan Roberts <ryan.roberts@....com>, Sean Christopherson
 <seanjc@...gle.com>, Shaoqin Huang <shahuang@...hat.com>,
 Suzuki K Poulose <suzuki.poulose@....com>, Wei Xu <weixugc@...gle.com>,
 Will Deacon <will@...nel.org>, Yu Zhao <yuzhao@...gle.com>,
 Zenghui Yu <yuzenghui@...wei.com>, kvmarm@...ts.linux.dev,
 kvm@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
 linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH v6 05/11] mm: Add fast_only bool to test_young and
 clear_young MMU notifiers

On 02.08.24 01:13, James Houghton wrote:
> On Thu, Aug 1, 2024 at 2:36 AM David Hildenbrand <david@...hat.com> wrote:
>>
>> On 24.07.24 03:10, James Houghton wrote:
>>> For implementers, the fast_only bool indicates that the age information
>>> needs to be harvested such that we do not slow down other MMU operations,
>>> and ideally that we are not ourselves slowed down by other MMU
>>> operations.  Usually this means that the implementation should be
>>> lockless.
>>
>> But what are the semantics if "fast_only" cannot be achieved by the
>> implementer?
>>
>> Can we add some documentation to the new functions that explain what
>> this mysterious "fast_only" is and what the expected semantics are?
>> Please? :)
> 
> Thanks for pointing out the missing documentation. How's this?
> 
> diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.h
> index 45c5995ebd84..c21992036dd3 100644
> --- a/include/linux/mmu_notifier.h
> +++ b/include/linux/mmu_notifier.h
> @@ -106,6 +106,18 @@ struct mmu_notifier_ops {
>           * clear_young is a lightweight version of clear_flush_young. Like the
>           * latter, it is supposed to test-and-clear the young/accessed bitflag
>           * in the secondary pte, but it may omit flushing the secondary tlb.
> +        *

Probably makes sense to highlight the parameters like @fast_only

> +        * The fast_only parameter indicates that this call should not block,
> +        * and this function should not cause other MMU notifier calls to
> +        * block. Usually this means that the implementation should be
> +        * lockless.
> +        *
> +        * When called with fast_only, this notifier will be a no-op unless
> +        * has_fast_aging is set on the struct mmu_notifier.

"... and will return 0 (NOT young)." ?

> +        *
> +        * When fast_only is true, if the implementer cannot determine that a
> +        * range is young without blocking, it should return 0 (i.e.,
> +        * that the range is NOT young).
>           */
>          int (*clear_young)(struct mmu_notifier *subscription,
>                             struct mm_struct *mm,
> @@ -118,6 +130,8 @@ struct mmu_notifier_ops {
>           * the secondary pte. This is used to know if the page is
>           * frequently used without actually clearing the flag or tearing
>           * down the secondary mapping on the page.
> +        *
> +        * The fast_only parameter has the same meaning as with clear_young.
>           */
>          int (*test_young)(struct mmu_notifier *subscription,
>                            struct mm_struct *mm,
> 
> I've also moved the commit that follows this one (the one that adds
> has_fast_aging) to be before this one so that the comment makes sense.


Makes sense, thanks!

-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ