[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAG_fn=X_E7r7JnBKWTygwiTa7HWJ1=AhtJOoH7is_mz0fhgfXA@mail.gmail.com>
Date: Thu, 2 Mar 2023 15:48:29 +0100
From: Alexander Potapenko <glider@...gle.com>
To: Marco Elver <elver@...gle.com>
Cc: linux-kernel@...r.kernel.org, linux-mm@...ck.org,
tglx@...utronix.de, mingo@...hat.com, bp@...en8.de, x86@...nel.org,
dave.hansen@...ux.intel.com, hpa@...or.com,
akpm@...ux-foundation.org, dvyukov@...gle.com, nathan@...nel.org,
ndesaulniers@...gle.com, kasan-dev@...glegroups.com
Subject: Re: [PATCH 2/4] kmsan: another take at fixing memcpy tests
> > +#define DO_NOT_OPTIMIZE(var) asm("" ::: "memory")
>
> That's just a normal "barrier()" - use that instead?
Ok, will do (I still think I'd better hide it behind a macro so that
we can change the implementation of DO_NOT_OPTIMIZE in the future if
the compiler starts outsmarting us again.
> > +/*
> > + * Test case: ensure that memcpy() correctly copies initialized values.
> > + */
> > +static void test_init_memcpy(struct kunit *test)
> > +{
> > + EXPECTATION_NO_REPORT(expect);
> > + volatile int src;
> > + volatile int dst = 0;
> > +
> > + // Ensure DO_NOT_OPTIMIZE() does not cause extra checks.
>
> ^^ this comment seems redundant now, given DO_NOT_OPTIMIZE() has a
> comment (it's also using //-style comment).
Moved it to the test description:
/*
* Test case: ensure that memcpy() correctly copies initialized values.
* Also serves as a regression test to ensure DO_NOT_OPTIMIZE() does not cause
* extra checks.
*/
I think it's still relevant here.
Powered by blists - more mailing lists