Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp66201pxb; Thu, 27 Jan 2022 15:13:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJwBL6NrhRQbnCFqLEyH3a4dnghiUU5xCtukxYQQTbi5wD7DdgzoaTh8E+25E4bQH2eqd55x X-Received: by 2002:a17:906:25cb:: with SMTP id n11mr4583140ejb.419.1643325234637; Thu, 27 Jan 2022 15:13:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643325234; cv=none; d=google.com; s=arc-20160816; b=OnyKzsHFhr0CWWczt1JYcd05hPnDrGeUwKuZIP5sFyadWSGPBXxJ2NcJlz0L3bdncT rhZ3Xg44O0GrGKi0ZgHQSzFPlzbhv4w2pXOsGlJ/MlEvDwkzB1gMDjV91wbS1IPFCjGg d3lQE/NViBO2ZO1wbTcCjaJXC0N7cFY+ZwOnmWMGx1q88c6juzo/Cy8NlLd+H9YBGmCd /KlZW8nK9zcLIYelC37PrGyCfadFU5EyprrKJ+arC4SmyPaDPduci7vvtP9bNrhNYkgy gwpct7xmJIdW/PHGkqUud0QZ7v7rmiEPJdInQ5D6XdhLzK58xmB36OdeJMKfwx5q3kF2 nmdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=qSHHDT/Ul5pdE8P6t8ktZ9Ch92LKxsTFGQCx9xs50Ts=; b=OPGr0Tbn0dqAX01iawDcRntE9+CywaNvJi8KFJWbRIRAruzUOeBezeTPUcGaWzbnRl v5ZGXckNLs53g13C4GZptoMytmp+gS08fcK3OdsZFX9qwkiawiBSB8MceH3YpRQLSVkU 0mF4EX0aez63SK9HJ7oQJkKoBCe9fmnstpHskTx7mvmo+4CQtfX5tPE8RUdiaiJHmYd1 8oajBpEnbNQPQfJnqlR4VEvR5DlSwXjZhOVVCP0P2Wrzai/nTcX1btofU4AzfND9h3Mg fi2OC00aj0XxO7P6s21J0ZblbAnLsLMZcLzJYTMIG1ljhtOmzqmcPqBzHTukrR40mG2B AlqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=LYymgM7g; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=1mjwPP3A; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r18si1028743edd.183.2022.01.27.15.13.30; Thu, 27 Jan 2022 15:13:54 -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=@linutronix.de header.s=2020 header.b=LYymgM7g; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=1mjwPP3A; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230297AbiA0Mnu (ORCPT + 99 others); Thu, 27 Jan 2022 07:43:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229689AbiA0Mns (ORCPT ); Thu, 27 Jan 2022 07:43:48 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A193C061714 for ; Thu, 27 Jan 2022 04:43:47 -0800 (PST) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1643287424; h=from:from:reply-to:subject:subject: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=qSHHDT/Ul5pdE8P6t8ktZ9Ch92LKxsTFGQCx9xs50Ts=; b=LYymgM7gSvAe12Kl0R+39pP7HTY/Uxe4k/fIaFhilZ7BMilRUQ1dVAl/6qkc03kPf/esZL GlTVjVtX1RaD7OkB9LM7QHRe+e+QBtapPUzs4vOcytGj9CWsQwI0iXaPrSUFxrLLYfnq9N sm9QEksAmz4l1vpWZmOJU6Pxx0q6I4y6ELMupPefWEBHWYzbGbavSMqIFDZMyPrHlg78dc ho4KmZDEC+eJQaCer/kGKjyoWLRUd3/HSxTBlRAZm4s8t7yWgkUXAFRIgcjokuD5aV0TV8 /aZE43XZ2JxrfpqI8qnxS/h/lwLPPloZYDd2ZqyZS7P3p5437r0GFleeI2QlwA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1643287424; h=from:from:reply-to:subject:subject: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=qSHHDT/Ul5pdE8P6t8ktZ9Ch92LKxsTFGQCx9xs50Ts=; b=1mjwPP3APj9JnPBTx4fhkY/v7JblGGEk2mjg8PXe7hcZHnDDrmFM4i5A8iDOcb8kfBGY4H SH2VcKslMiHM7wAQ== To: Petr Mladek , Sergey Senozhatsky Cc: Stephen Brennan , Steven Rostedt , Sergey Senozhatsky , linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/4] printk: disable optimistic spin during panic In-Reply-To: References: <20220121190222.572694-1-stephen.s.brennan@oracle.com> <20220121190222.572694-3-stephen.s.brennan@oracle.com> <87r18un83x.fsf@jogness.linutronix.de> <87tudqwegy.fsf@stepbren-lnx.us.oracle.com> Date: Thu, 27 Jan 2022 13:49:44 +0106 Message-ID: <877dalpcvz.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-01-27, Petr Mladek wrote: > I mean that chance of dealock caused by the internal semaohore spin > lock is super small. In compare, a lot of tricky code is guarded > by console_sem. It looks like a big risk to ignore the semaphore > early in panic(). Agreed. > A better solution would be to use raw_spin_trylock_irqsave() in > down_trylock(). down_trylock() is attempting to decrement a semaphore. It should not fail just because another CPU is also in the process of decrementing/incrementing the semaphore. Maybe a down_trylock_cond() could be introduced where the trylock could fail if a given condition is not met. The function would need to implement its own internal trylock spin loop to check the condition. But then we could pass in a condition for it to abort. For example, when in panic and we are not the panic CPU. John