Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp5476609pxb; Wed, 26 Jan 2022 12:57:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJx5+roC0nlZUAdzdWR30Infp2qUb1JQSBzezwYI7V8SWJpWMZH+LWXzsWwOzab8Hgm2tvMk X-Received: by 2002:a17:906:dc92:: with SMTP id cs18mr445898ejc.590.1643230651493; Wed, 26 Jan 2022 12:57:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643230651; cv=none; d=google.com; s=arc-20160816; b=ECdLxAU7odI31i/ZnMwNqCE2uuLDWdtBCIpgSQuAlpztC0wZvX2D4x1+f01+w2kzIs 8Tq1krw/L4O+ZZDlLGsAf+iDkt1HsMpZH1xrz30NXmHFLSWyqwgqkJ2CbeNR/f0RLQdz RRkdufC90zg1dPo2Bx/otlPeLOg/siscJLr6TfqVJtzBQodTTj05oZSCbHIu2Yrb9754 IXJDahBKJREUGs8mvk8EIyf8hpZfjeFWRYctlEtyDe96FCZ10u88UfDJ487uAtI/fYL9 1PJbRwjBuknej0AUbNXIjffdt66nTzEfgXyoQrOC48h6MxxcuCfFtLpsFSUvmJ647P2m a2Ag== 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=hfkv8xA2MTmD65MJmGmZeGhLuFk88prf6bIKcrAiQzk=; b=VKOzULfkCVD3lK6Q9N8+7Zw6/wQEma1EVkGV/Xfu2YGR+lkXxB2B5mm10/PHSxk/qi QfWWgvl6rLeGwH9zsQTPkD4ybKHHoqHzzSWDtrtqqPh4h6+rTcZm5mST+3luwaIWEKeY aWdrlGTuqDAwFYnSx7WC/wffEUZl7z/unJie33+cwtI67HDyb/wbT9xnGbuFE62P2WAn Gi86HCubslL5OocNwr+wZjnY0XU5rf9CVtumyaSkW82f25OdRZX2pJciJ+K0M+x3L4h4 TdlrcnbLufoHWx+KQMrB4pQ8MOWgT+VN7hwJFROpwQajYQkX7aR1kMlGHijc6yhLKTE4 VpRA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jsRGPN1U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hs36si202803ejc.463.2022.01.26.12.57.06; Wed, 26 Jan 2022 12:57:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jsRGPN1U; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239593AbiAZKGw (ORCPT + 99 others); Wed, 26 Jan 2022 05:06:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239581AbiAZKGv (ORCPT ); Wed, 26 Jan 2022 05:06:51 -0500 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10D44C06161C for ; Wed, 26 Jan 2022 02:06:51 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id y17so11569892plg.7 for ; Wed, 26 Jan 2022 02:06:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=hfkv8xA2MTmD65MJmGmZeGhLuFk88prf6bIKcrAiQzk=; b=jsRGPN1UZO9nDlDSnn4Q1zEjZeZJh2DfHs2jyGzUGud2xIq5zEk+032ahEATQij2ce crQrdFVK+oKQpEWQ8jp7Pp2/6UZJEZxV4UtMW28dU6hjhsorq8eGs2GORCCHiGSWqI79 IUCZNNNeqxv7dZq2xsAzYC0uQfdWB6Vv1I3nQ= 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; bh=hfkv8xA2MTmD65MJmGmZeGhLuFk88prf6bIKcrAiQzk=; b=7po06Rt6oDYIIzknajzyzxxyqGa6bmP21aef6UnSDmooFAUEAorQAFxsiwKoq4XZos yQFWQfvrbsV67+UqKsfMsEcnfqq1reATTPN8RVub48mABF0HGYIdy6jCqbakpmkJkmp0 Sb+M4XtBACyyP796ePNkyWufCQRvv739sSONIPIJuBe4w/7TBd9wky5JjbO5VzaBToOL QdaJbixrcezZPn6v83ikCzUMIQhO2Gb+F7egAigc5Q/j9FWi5Pq1/kr6xxPyZt9cR9kr Xi+Y/2gRSyxkcCCACHtY5gvqSqBpVcv1kEF0QV/+TMzBgrqXYnIlj2G8yHB6OZD4SfoS wi/A== X-Gm-Message-State: AOAM531/Ct8v9pAIyKkpOkT0DbJnniPIpfQHLN+9f9pWs5g1kJ0Fq8Ce mUV17h4BPSNChtLKVbBopx2YCA== X-Received: by 2002:a17:90a:53:: with SMTP id 19mr7923701pjb.159.1643191610615; Wed, 26 Jan 2022 02:06:50 -0800 (PST) Received: from google.com ([2401:fa00:8f:203:7bbc:f635:b767:2a8a]) by smtp.gmail.com with ESMTPSA id bj7sm2572947pjb.9.2022.01.26.02.06.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jan 2022 02:06:49 -0800 (PST) Date: Wed, 26 Jan 2022 19:06:44 +0900 From: Sergey Senozhatsky To: John Ogness Cc: Sergey Senozhatsky , Stephen Brennan , Petr Mladek , Steven Rostedt , Sergey Senozhatsky , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] printk: disable optimistic spin during panic Message-ID: References: <20220121190222.572694-1-stephen.s.brennan@oracle.com> <20220121190222.572694-3-stephen.s.brennan@oracle.com> <87r18un83x.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87r18un83x.fsf@jogness.linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (22/01/26 10:51), John Ogness wrote: > > Is there something that prevents panic CPU from NMI hlt CPU which is > > in console_trylock() under raw_spin_lock_irqsave()? > > > > CPU0 CPU1 > > console_trylock_spinnning() > > console_trylock() > > down_trylock() > > raw_spin_lock_irqsave(&sem->lock) > > > > panic() > > crash_smp_send_stop() > > NMI -> HALT > > This is a good point. I wonder if console_flush_on_panic() should > perform a sema_init() before it does console_trylock(). A long time ago there was zap_locks() function in printk, that used to re-init console semaphore and logbuf spin_lock, but _only_ in case of printk recursion (which was never reliable) https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/kernel/printk/printk.c?h=v4.9.297#n1557 This has been superseded by printk_safe per-CPU buffers so we removed that function. So it could be that may be we want to introduce something similar to zap_locks() again. All reasonable serial consoles drivers should take oops_in_progress into consideration in ->write(), so we probably don't care for console_drivers spinlocks, etc. but potentially can do a bit better on the printk side.