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] [day] [month] [year] [list]
Message-ID: <CABVgOSmCdtnFatO+EU0T9fado1h7ZW0DAzO=Y2jPvt6mTmO57A@mail.gmail.com>
Date:   Fri, 25 Nov 2022 16:33:11 +0800
From:   David Gow <davidgow@...gle.com>
To:     Hyeonggon Yoo <42.hyeyoo@...il.com>
Cc:     Brendan Higgins <brendan.higgins@...ux.dev>,
        Daniel Latypov <dlatypov@...gle.com>,
        Shuah Khan <skhan@...uxfoundation.org>,
        kunit-dev@...glegroups.com, linux-kselftest@...r.kernel.org,
        linux-kernel@...r.kernel.org, Kees Cook <keescook@...omium.org>,
        linux-doc@...r.kernel.org, linux-mm@...ck.org,
        Oliver Glitta <glittao@...il.com>,
        Christoph Lameter <cl@...ux.com>,
        Vlastimil Babka <vbabka@...e.cz>,
        David Rientjes <rientjes@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH v3 3/3] mm: slub: test: Use the kunit_get_current_test() function

On Thu, Nov 24, 2022 at 6:43 PM Hyeonggon Yoo <42.hyeyoo@...il.com> wrote:
>
> On Sat, Nov 19, 2022 at 04:12:52PM +0800, David Gow wrote:
> > Use the newly-added function kunit_get_current_test() instead of
> > accessing current->kunit_test directly. This function uses a static key
> > to return more quickly when KUnit is enabled, but no tests are actively
> > running. There should therefore be a negligible performance impact to
> > enabling the slub KUnit tests.
> >
> > Other than the performance improvement, this should be a no-op.
> >
> > Cc: Oliver Glitta <glittao@...il.com>
> > Cc: Hyeonggon Yoo <42.hyeyoo@...il.com>
> > Cc: Christoph Lameter <cl@...ux.com>
> > Cc: Vlastimil Babka <vbabka@...e.cz>
> > Cc: David Rientjes <rientjes@...gle.com>
> > Cc: Andrew Morton <akpm@...ux-foundation.org>
> > Signed-off-by: David Gow <davidgow@...gle.com>
> > Acked-by: Vlastimil Babka <vbabka@...e.cz>
>
> Acked-by: Hyeonggon Yoo <42.hyeyoo@...il.com>
> with small comment:
>

Thanks very much!

> > ---
> >
> > This is intended as an example use of the new function. Other users
> > (such as KASAN) will be updated separately, as there would otherwise be
> > conflicts.
> >
> > We'll take this whole series via the kselftest/kunit tree.
> >
> > Changes since v2:
> > https://lore.kernel.org/all/20221025071907.1251820-3-davidgow@google.com/
> > - Get rid of a redundant 'likely' (Thanks Vlastimil Babka)
> > - Use current->kunit_test directly when we already know a test is
> >   running. (Thanks Vlastimil Babka)
> > - Add Vlastimil's Acked-by.
> >
> > There was no v1 of this patch. v1 of the series can be found here:
> > https://lore.kernel.org/linux-kselftest/20221021072854.333010-1-davidgow@google.com/T/#u
> >
> > Cheers,
> > -- David
> >
> > ---
> >  lib/slub_kunit.c | 1 +
> >  mm/slub.c        | 3 ++-
> >  2 files changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/lib/slub_kunit.c b/lib/slub_kunit.c
> > index 7a0564d7cb7a..8fd19c8301ad 100644
> > --- a/lib/slub_kunit.c
> > +++ b/lib/slub_kunit.c
> > @@ -1,5 +1,6 @@
> >  // SPDX-License-Identifier: GPL-2.0
> >  #include <kunit/test.h>
> > +#include <kunit/test-bug.h>
>
> Is this #include needed in slub_kunit.c?
>

Yes: kunit_get_current_test() is defined in test-bug.h.

This header contains functions which are always available, even when
KUnit is not enabled.

(It's name isn't great: we may rename/refactor it down the line...)

Cheers,
-- David

Download attachment "smime.p7s" of type "application/pkcs7-signature" (4003 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ