Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp169458iob; Mon, 2 May 2022 16:10:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzikbD6xOm3q6L//m2Jlyk4n1wFSRA1f6CwR7WdO/asnMP4NpQRLw1S12lplgX8OxFDjjRO X-Received: by 2002:a65:4789:0:b0:3c1:d4ae:2d1c with SMTP id e9-20020a654789000000b003c1d4ae2d1cmr10028621pgs.15.1651533014670; Mon, 02 May 2022 16:10:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651533014; cv=none; d=google.com; s=arc-20160816; b=mzTcWh5N7wztr0xsKqoNPnwlaLYos+7qqH1hZhtKvZ+oxMebdJTK7oq5sxo7QRXbyi R3mBHu1nSUggGLSSRh5pwqrVtgmNNhhKCM4mBr9QK0/tnljRwX8/5IaTeXPS1bkkcuEU frYqTy5aHi1JkfvRMCSS0D4I//pEr2kN374j5tmlSe1h3Cdzmmy5VxThy1GdRtDpoN5z MDJHHuZPzKBVfTLujH9QbkB7yN0UQhItl75N1A8JOTKDYbHLJ3Bk3DwwD3y7TBTC8VlH NO0les+44OE0gaMFem1Fyntk15+EJPY3O5r4z+AuVHgjzaKrLx6sTFOrJ4SZZ3CiCBcY xgBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=iKHp6HnhHDWvm6k4RMfwy16wpKWbSYU7Y8KyP4lIRmM=; b=FVdSubNOS8qi3wVhdO3eRFnUBi281GgzSubPxoali67LD41wtMgu0a+0UnzlJpA8Yb djXlSU4yrqhP3swY2EvmYuR4IZuEqZFP6GkUJnhN0tJUbPUVU252mrVNixz3G6JPfocQ Rh8hzFJyDpDgBDaIBdSKzzW2xz/Nk57ZCyXrf2DagWCN6eSXm10l3+AUYc63nqXFgPmC +lLAH30yNnNqV4neEgGAJA2+P7A21Qe2yD4GK/cFdyTeuow6YxAnDdmu0+H89/acj+yF UWsnG3joBsCapAo+WiEnKPT5LxAOxucSOi71Q4dJJaO7WpyIPanDIvC3lsGjnIQiEJzy Ahww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=iHlzlpqa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id q10-20020a63504a000000b003c19e2b283esi10126388pgl.494.2022.05.02.16.10.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 16:10:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=iHlzlpqa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9433F2FE54; Mon, 2 May 2022 16:09:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385214AbiEBNVI (ORCPT + 99 others); Mon, 2 May 2022 09:21:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385204AbiEBNVG (ORCPT ); Mon, 2 May 2022 09:21:06 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B69B5FD3F for ; Mon, 2 May 2022 06:17:37 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 70DAA1F388; Mon, 2 May 2022 13:17:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1651497456; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=iKHp6HnhHDWvm6k4RMfwy16wpKWbSYU7Y8KyP4lIRmM=; b=iHlzlpqaBiIzj1Rd8rzo/nB+kiMLE4SCjLnY+bqL8EuJ1hdoSKJn2e1xiivU2AONmJZ36L wIUdJd96SiFCfQpDmMuKcThBG05A3ehCFRtMgwmnm3IwBkRK41sOhlfBSz17EyuS+zXOCx 7ZLI/xQ2HmWTYkvqtaXG0MXJ9kSMvrE= Received: from suse.cz (unknown [10.100.224.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 1CDC82C141; Mon, 2 May 2022 13:17:35 +0000 (UTC) Date: Mon, 2 May 2022 15:17:32 +0200 From: Petr Mladek To: Marek Szyprowski Cc: John Ogness , Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Greg Kroah-Hartman , linux-amlogic@lists.infradead.org Subject: Re: [PATCH printk v5 1/1] printk: extend console_lock for per-console locking Message-ID: References: <2a82eae7-a256-f70c-fd82-4e510750906e@samsung.com> <87fslyv6y3.fsf@jogness.linutronix.de> <51dfc4a0-f6cf-092f-109f-a04eeb240655@samsung.com> <87k0b6blz2.fsf@jogness.linutronix.de> <32bba8f8-dec7-78aa-f2e5-f62928412eda@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <32bba8f8-dec7-78aa-f2e5-f62928412eda@samsung.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 2022-05-02 11:19:07, Marek Szyprowski wrote: > Hi John, > > On 30.04.2022 18:00, John Ogness wrote: > > On 2022-04-29, Marek Szyprowski wrote: > >> The same issue happens if I boot with init=/bin/bash > > Very interesting. Since you are seeing all the output up until you try > > doing something, I guess receiving UART data is triggering the issue. > > Right, this is how it looks like. > > >> I found something really interesting. When lockup happens, I'm still > >> able to log via ssh and trigger any magic sysrq action via > >> /proc/sysrq-trigger. > > If you boot the system and directly login via ssh (without sending any > > data via serial), can you trigger printk output on the UART? For > > example, with: > > > > echo hello > /dev/kmsg > > > > (You might need to increase your loglevel to see it.) > > Data written to /dev/kmsg and all kernel logs were always displayed > correctly. Also data written directly to /dev/ttyAML0 is displayed > properly on the console. The latter doesn't however trigger the input > related activity. > > It looks that the data read from the uart is delivered only if other > activity happens on the kernel console. If I type 'reboot' and press > enter, nothing happens immediately. If I type 'date >/dev/ttyAML0' via > ssh then, I only see the date printed on the console. However if I type > 'date >/dev/kmsg', the the date is printed and reboot happens. This is really interesting. 'date >/dev/kmsg' should be handled like a normal printk(). It should get pushed to the console using printk kthread, that calls call_console_driver() that calls con->write() callback. In our case, it should be meson_serial_console_write(). I am not sure if meson_serial_console_write() is used also when writing via /dev/ttyAML0. > > >> It turned out that the UART console is somehow blocked, but it > >> receives and buffers all the input. For example after issuing "echo > >> >/proc/sysrq-trigger" from the ssh console, the UART console has been > >> updated and I see the magic sysrq banner and then all the commands I > >> blindly typed in the UART console! However this doesn't unblock the > >> console. > > sysrq falls back to direct printing. This would imply that the kthread > > printer is somehow unable to print. > > > >> Here is the output of 't' magic sys request: > >> > >> https://protect2.fireeye.com/v1/url?k=8649f24d-e73258c4-86487902-74fe48600034-a2ca6bb18361467d&q=1&e=1bc4226f-a422-42b9-95e8-128845b8609f&u=https%3A%2F%2Fpastebin.com%2FfjbRuy4f > > It looks like the call trace for the printing kthread (pr/ttyAML0) is > > corrupt. > > Right, good catch. For comparison, here is a 't' sysrq result from the > 'working' serial console (next-20220429), which happens usually 1 of 4 > boots: > > https://pastebin.com/mp8zGFbW Strange. The backtrace is weird here too: [ 50.514509] task:pr/ttyAML0 state:R running task stack: 0 pid: 65 ppid: 2 flags:0x00000008 [ 50.514540] Call trace: [ 50.514548] __switch_to+0xe8/0x160 [ 50.514561] meson_serial_console+0x78/0x118 There should be kthread() and printk_kthread_func() on the stack. Hmm, meson_serial_console+0x78/0x118 is weird on its own. meson_serial_console is the name of the structure. I would expect a name of the .write callback, like meson_serial_console_write() Best Regards, Petr