From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C784C433F5 for ; Mon, 2 May 2022 07:51:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4162D6B0072; Mon, 2 May 2022 03:51:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3C4BF6B0073; Mon, 2 May 2022 03:51:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 264596B0074; Mon, 2 May 2022 03:51:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id 184A96B0072 for ; Mon, 2 May 2022 03:51:56 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id C88F521B54 for ; Mon, 2 May 2022 07:51:55 +0000 (UTC) X-FDA: 79420034190.25.7610E0A Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by imf31.hostedemail.com (Postfix) with ESMTP id D69C620076 for ; Mon, 2 May 2022 07:51:41 +0000 (UTC) Received: by mail-wr1-f44.google.com with SMTP id x18so18581702wrc.0 for ; Mon, 02 May 2022 00:51:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=f/iZcbm+HsfS7NtVRG8PqR/TcI1wEubO1WbobcyN2js=; b=NrF1p/vNwCzwdOYH7qCK1EBvF/CKACJY2M9sKOXdr6oQJseU4N4LwaXAB6h2h5cNWq 0lxfrVjHZkVZV/LXmNg4T9vhuLCrzjRXijIwClM9wI1G3XRMOYjNobEoosZIiOgOvzZq 2mDl8j8F0eKZuYiYPNOQ0ONvaf7yL+d1UqgN6bWUHX41ncUrQLxCnVRxSvADN2hGmRgK WOS4Yn/c06NzsBUhv3MFLh+ln9zmVdzkPTAuPdRRp3Ir4TDN8edrajtGYYe+yla24mpZ it1GjNJoKk3JzC6K+QNAqqptIH41WfOJXzIcTejDGsFy3SCtiiogW7z7Xg0EZowfP/VF N+kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=f/iZcbm+HsfS7NtVRG8PqR/TcI1wEubO1WbobcyN2js=; b=NCJsseZYnqbHtK9vQXjHTftbpDaJn7m1dEBbOIhF7of85LM04uSyl2GeEhwc2sa0Ck dRD9rA16igzpiF4tQWxg0RiABekYxk/NvvzC5RLt/redJxJlQ3rztpqTElGyV32tGuys yM8H2bJrxAjz+lTCGgqzVYmLwQ+DK98GtWU+fsYm4KgIezddFGIWbXCHAljkhCbJc4M/ 8qllhkvKZ2uHXLwydqW0nXi6eYKC4PsQ4MwnEAkFKrTY61hbR50/MZjp4lyrMYHi7vS2 AuCyc2eWH69HC7gTm/NLF1O0ZRBecHnuNP9PeJj6l4KtQgmVg16Q0YCZ6Xs6QKt2JFpE gOTA== X-Gm-Message-State: AOAM532aucXc6Wuz3GO+PnrQEjbk8JKF3sx3veULeAqqSVYhgxVjE/e3 sPAlts7HsNCnTszR9ZHQTWDOEw== X-Google-Smtp-Source: ABdhPJxsSzLA8P20zIPWb1gO6clHzj+py+j7QZhWipmTlyvk1D+UG5nDQrYdqbUSvV1EkldQMALWLw== X-Received: by 2002:adf:f0cb:0:b0:20a:ef39:d42b with SMTP id x11-20020adff0cb000000b0020aef39d42bmr8699587wro.8.1651477913781; Mon, 02 May 2022 00:51:53 -0700 (PDT) Received: from elver.google.com ([2a00:79e0:15:13:ee30:3795:2e49:1a19]) by smtp.gmail.com with ESMTPSA id z10-20020a1c4c0a000000b003942a244f54sm5668256wmf.45.2022.05.02.00.51.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 00:51:53 -0700 (PDT) Date: Mon, 2 May 2022 09:51:46 +0200 From: Marco Elver To: John Ogness Cc: Naresh Kamboju , Petr Mladek , Linux-Next Mailing List , open list , lkft-triage@lists.linaro.org, linux-mm , Andrew Morton , Alexander Potapenko , Dmitry Vyukov , Stephen Rothwell , Anders Roxell , Andrey Konovalov , Andrey Ryabinin , Catalin Marinas , Evgenii Stepanov , Mark Rutland , Peter Collingbourne , Vincenzo Frascino , Will Deacon Subject: Re: [next] i386: kunit: ASSERTION FAILED at mm/kfence/kfence_test.c:547 Message-ID: References: <87fslup9dx.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87fslup9dx.fsf@jogness.linutronix.de> User-Agent: Mutt/2.1.4 (2021-12-11) X-Stat-Signature: wuz6eqmbf5kjgaztf78a54ogb8mmdcwm Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b="NrF1p/vN"; spf=pass (imf31.hostedemail.com: domain of elver@google.com designates 209.85.221.44 as permitted sender) smtp.mailfrom=elver@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: D69C620076 X-HE-Tag: 1651477901-272734 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat, Apr 30, 2022 at 11:14PM +0206, John Ogness wrote: [...] > I am not familiar with how this works. Is the tracepoint getting set on > call_console_drivers()? Or on call_console_driver()? It's at the start of call_console_drivers(). See trace_console_rcuidle() call. > If so, there are a couple problems with that. First off, the prototype > for that function has changed. Second, that function is called when text > is printed, but this is not when the text was created. With the > kthreads, the printing can be significantly delayed. > > Since printk() is now lockless and console printing is delayed, it > becomes a bit tricky to parse the records in the existing code using a > tracepoint. > > I wonder if creating a NOP function for the kfence probe to attach to > would be more appropriate. In printk_sprint() we get the text after > space has been reserved, but before the text is committed to the > ringbuffer. This is guaranteed to be called from within the printk() > context. I think we just need to fix the existing tracepoint, since it has changed its semantics vs. what it was intended to be: | commit 95100358491abaa2e9a5483811370059bbca4645 | Author: Johannes Berg | Date: Thu Nov 24 20:03:08 2011 +0100 | | printk/tracing: Add console output tracing | | Add a printk.console trace point to record any printk | messages into the trace, regardless of the current | console loglevel. This can help correlate (existing) | printk debugging with other tracing. | | Link: http://lkml.kernel.org/r/1322161388.5366.54.camel@jlt3.sipsolutions.net | | Acked-by: Frederic Weisbecker | Cc: Christoph Hellwig | Cc: Ingo Molnar | Acked-by: Peter Zijlstra | Acked-by: Thomas Gleixner | Signed-off-by: Johannes Berg | Signed-off-by: Steven Rostedt Specifically using it to "correlate (existing) printk debugging with other tracing" is now broken. > Here is an example of what I am thinking... > > --- a/kernel/printk/printk.c > +++ b/kernel/printk/printk.c > @@ -2227,6 +2227,10 @@ static u16 printk_sprint(char *text, u16 size, int facility, > } > } > > +#ifdef CONFIG_KFENCE_KUNIT_TEST > + printk_kfence_check(text, text_len); > +#endif > + > return text_len; > } > > The probe_console() could attach to a NOP function printk_kfence_check(). Thanks for this! However, I think we can't have a KFENCE-specific helper, it needs to be a tracepoint, because there are more tests that want to check console output (kernel/kcsan/kcsan_test.c did this before the KFENCE test actually). My proposal would be to fix the tracepoint like so: | --- a/kernel/printk/printk.c | +++ b/kernel/printk/printk.c | @@ -2002,8 +2002,6 @@ static void call_console_driver(struct console *con, const char *text, size_t le | { | size_t dropped_len; | | - trace_console_rcuidle(text, len); | - | if (con->dropped && dropped_text) { | dropped_len = snprintf(dropped_text, DROPPED_TEXT_MAX, | "** %lu printk messages dropped **\n", | @@ -2178,6 +2176,8 @@ static u16 printk_sprint(char *text, u16 size, int facility, | } | } | | + trace_console_rcuidle(text, text_len); | + | return text_len; | } This fixes the KFENCE and KCSAN tests. Unless I hear objections, I'll prepare a patch explaining why we need to fix the tracepoint. Thanks, -- Marco