Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3254188rdh; Mon, 27 Nov 2023 09:32:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IGVIwpv1F2vgdtPQAKYqV9ann2sby+sWq7mOGfBwyNn/1u2Vmh0hQzQp9PeFckk9c8itAJC X-Received: by 2002:a05:6a21:190:b0:18b:9041:5729 with SMTP id le16-20020a056a21019000b0018b90415729mr16592877pzb.17.1701106364239; Mon, 27 Nov 2023 09:32:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701106364; cv=none; d=google.com; s=arc-20160816; b=jJkeUgRVWLZq5LTce8EAV4xIpKd3NMp+GNIStUm1zFdA4vICGR9OUr9F+4R9pdwqLC 7IyymDnrSyC7Klo/r5I6PBfOK2ghur9TvHBIsV5BeZwtjf+rlGU76SibxNYAHwSMtg77 kHtlrrVLuTCvxTjMlymNprXsztjBuXBTG5V4+VTtp0YfMdalqNcc1tccbNQYQlVcA96d eUGNzIujHty3pnsDIYoy/RDYff5+yby6TzOOoFIlwr+TG0+eCNlG/kroPc2j2LQsOVr7 JfL9KLSouxBAJi3jKRKC80sDUUYe0XlRIqG0J+o4Eio2tsJamAWF5qWRSvI15zpTrotk 76xw== 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=FeFGo3A/PHQytb3pAGL1mij1tGEA+VptDNWqWw5gmgQ=; fh=0gUqW+ds8mxJA05bnsmhYQnxVqm6sayvTuSvLA/EmZs=; b=Lekld+uZW9F9RcucnuZcOwPYPmTYozwoBg/Y/OmkfU5fIrF6o5+qX6/szzV8nVMH+p vZ9sqj9LPzvTqo38EjRDKhboiRT3B6kHM4/gDDFctOdzehEaYOQa0jGLZKMjpPT3aEtf 8UW6AFofOK9/qk7YEBR6/pwqqoovCkq+kyNtLcsSn640tiTrXay9+Ytwo0dltLZ1LyLw kblGkk+C4caQ8YpWqRk6ANn43xhmaDkBY/SR8rRDrFtzeCwEcOt3LBrosXwE4+vrcWpS wKkZdCBZ42BLf8PlbrJMfJL/XfmOXQM8o7VO0bbGK+Ti8rVLKzXEXw5IHp+ezHApZTV+ pEcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=GqSzwVWJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id j25-20020a63fc19000000b005b95ccd1b4dsi10124221pgi.82.2023.11.27.09.32.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Nov 2023 09:32:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=GqSzwVWJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id AD08A8099CEE; Mon, 27 Nov 2023 09:32:41 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230330AbjK0Rc1 (ORCPT + 99 others); Mon, 27 Nov 2023 12:32:27 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58962 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229541AbjK0RcY (ORCPT ); Mon, 27 Nov 2023 12:32:24 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6003A5 for ; Mon, 27 Nov 2023 09:32:29 -0800 (PST) Received: from relay2.suse.de (unknown [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 6CCA51FB6E; Mon, 27 Nov 2023 17:32:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1701106346; 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=FeFGo3A/PHQytb3pAGL1mij1tGEA+VptDNWqWw5gmgQ=; b=GqSzwVWJC6Sg+x+kK8orLAXycRBKq8w//2PwuwF49CCCOrrMPi0pxk6hjAwQ+TIu50tszh jwsxzuXgXs/h/hrUtDX2mSw68t9MueH7jOBkyMtl/+G7MM9goGRkx/pD5uoQkaAT5sYixC 6i8CBO6UTimB/2m8qbe8OW1t9gS23+s= Received: from suse.cz (pmladek.tcp.ovpn2.prg.suse.de [10.100.208.146]) (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 B10412C14F; Mon, 27 Nov 2023 17:32:24 +0000 (UTC) Date: Mon, 27 Nov 2023 18:32:23 +0100 From: Petr Mladek To: lizhe.67@bytedance.com Cc: dianders@chromium.org, akpm@linux-foundation.org, lecopzer.chen@mediatek.com, kernelfans@gmail.com, linux-kernel@vger.kernel.org, lizefan.x@bytedance.com Subject: Re: [PATCH v3] softlockup: serialized softlockup's log Message-ID: References: <20231123084022.10302-1-lizhe.67@bytedance.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231123084022.10302-1-lizhe.67@bytedance.com> X-Spamd-Bar: ++++++++++++++++++ Authentication-Results: smtp-out2.suse.de; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=suse.com (policy=quarantine); spf=fail (smtp-out2.suse.de: domain of pmladek@suse.com does not designate 149.44.160.134 as permitted sender) smtp.mailfrom=pmladek@suse.com X-Rspamd-Server: rspamd2 X-Spamd-Result: default: False [18.50 / 50.00]; RDNS_NONE(1.00)[]; SPAMHAUS_XBL(0.00)[149.44.160.134:from]; RWL_MAILSPIKE_GOOD(-1.00)[149.44.160.134:from]; TO_DN_NONE(0.00)[]; HFILTER_HELO_IP_A(1.00)[relay2.suse.de]; HFILTER_HELO_NORES_A_OR_MX(0.30)[relay2.suse.de]; R_RATELIMIT(0.00)[rip(RLa6h5sh378tcam5q78u)]; MX_GOOD(-0.01)[]; RCPT_COUNT_SEVEN(0.00)[7]; RCVD_NO_TLS_LAST(0.10)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(2.20)[]; MIME_TRACE(0.00)[0:+]; BAYES_HAM(-0.00)[23.09%]; RDNS_DNSFAIL(0.00)[]; ARC_NA(0.00)[]; R_SPF_FAIL(1.00)[-all]; FROM_HAS_DN(0.00)[]; DMARC_POLICY_QUARANTINE(1.50)[suse.com : No valid SPF, No valid DKIM,quarantine]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.com:s=susede1]; VIOLATED_DIRECT_SPF(3.50)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.com:email,bytedance.com:email]; FUZZY_BLOCKED(0.00)[rspamd.com]; MID_RHS_NOT_FQDN(0.50)[]; FREEMAIL_CC(0.00)[chromium.org,linux-foundation.org,mediatek.com,gmail.com,vger.kernel.org,bytedance.com]; RCVD_COUNT_TWO(0.00)[2]; HFILTER_HOSTNAME_UNKNOWN(2.50)[] X-Spam-Score: 18.50 X-Rspamd-Queue-Id: 6CCA51FB6E X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 27 Nov 2023 09:32:41 -0800 (PST) On Thu 2023-11-23 16:40:22, lizhe.67@bytedance.com wrote: > From: Li Zhe > > If multiple CPUs trigger softlockup at the same time with > 'softlockup_all_cpu_backtrace=0', the softlockup's logs will appear > staggeredly in dmesg, which will affect the viewing of the logs for > developer. Since the code path for outputting softlockup logs is not > a kernel hotspot and the performance requirements for the code are > not strict, locks are used to serialize the softlockup log output to > improve the readability of the logs. > > Signed-off-by: Li Zhe I do not feel fully comfortable with adding a lock into a code path which reports system lockups. There might already be a deadlock on the system and yet another lock would not make things easier. On the other hand, the added spinlock looks pretty safe: + It synchronizes only watchdog_timer_fn() calls against each other. watchdog_timer_fn() could not be nested. + The locked code seems to be synchronized only by RCU and does not wait for other CPUs to finish something. I haven't found any real deadlock scenario. Feel free to use: Reviewed-by: Petr Mladek Best Regards, Petr