Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1255305rbb; Mon, 26 Feb 2024 04:02:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUSe2B+BVpqRVwuz1plRyU2qNsBJZddkmDSeAvYK1E9G468SB2jHF6U9rMz73Hh26p31FUlZmkYLzC7pob2jnKlMzmFWsJ498ekkzn+FQ== X-Google-Smtp-Source: AGHT+IGjwEpu9hgCf4sw7kvZ4NcxHyPd9NjP40RJwqj57ZdK0O2Qf32/nxJSQFwRWr2oKcVBXprU X-Received: by 2002:a05:6e02:1045:b0:365:3d96:4b94 with SMTP id p5-20020a056e02104500b003653d964b94mr7107387ilj.5.1708948921991; Mon, 26 Feb 2024 04:02:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708948921; cv=pass; d=google.com; s=arc-20160816; b=r/UEUsLwbvxx0QAhmXseGyzQnYEyCLNbSb+ljHkdFjsjtsPBHo0DogHk9NjVsm/CPd L6I4OZrfGkm2wQm4pY18j/s/Bd3tPT7JVduWpS/ND+bTJCjlQ4uJRbeqsZIq7GppTcW2 rckBA47Lb8+33+7uDNEm/4VNLuelBZTDjPg07Sk6GVgLf1I4rqRDrKUENvlxtTY4gL/l 2lBJqeHXirKlNMM3hGfJvu2ond+U9hf0nrGIdQBH6dPsU4QMnyLN6RnQUESE5C1j+GZ0 cTFL/rMQFK5gBnpufSdg2/2cGO5pTWehG0WkDWxZ3qH9a9iHqNvFz3LOdxGekOmNuvxZ 0jjw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:references:in-reply-to:subject:cc:to:dkim-signature :dkim-signature:from; bh=ssDX0tZ9H4aDFqTnUDa/YmbnpDQsXNRYjqJeEeUC+QE=; fh=zQtNUD4bVhfr04umHcX+NdGHfLH6aI7S0/IDFRulQTU=; b=PA6S3tFxA0RjOHemwbw11/vdFmeZIVUir0KV9xFXSYrunNSxUx7v4RyO52lpAGX07U PgYzZqRcu39L1N99UHyqgb3aT2nnTNhTgFuqydYYrzwVgYG4uASpZ2djaGFDBQUWa8ig TYltShsjfPVU+SOeqycS3+rLrwIU+T6fM8gnduKFwhj7l/VIcui4IrZbdL9RZrUXDs5L 8n+Ys7Mb5eITtFsDNJ9xtbBLxJ79ID3dH0GfeGwqZxA08epiDZum+XOXKVSE5fw9kTK1 D80MiFND3JxImdlSqtGWN9Zifd8EUhEpAKq46sWM254gwiNRwgVEgi9F4lQdzQwi45zW ic3w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=WQcV0big; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-81323-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81323-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id x21-20020a63b215000000b005cd90b47495si3571132pge.264.2024.02.26.04.02.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 04:02:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81323-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=WQcV0big; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-81323-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81323-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id A613629087C for ; Mon, 26 Feb 2024 12:02:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 12EC15B1FE; Mon, 26 Feb 2024 12:01:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="WQcV0big"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="NficySbP" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE9E01DA5F for ; Mon, 26 Feb 2024 12:01:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708948915; cv=none; b=RVAfFw7V7otsGPHvk2GRIyLCAMP5wZ/VwjEaHz89HpR+sdP1u8dUSoRvYcU//nWgjeJiC0zdE6Lej6lw+SeNRTr82aogw2Td7pEAv2uphIKYox+RpU0532EcLwxIq7MsjDvPCkCN4b371xizsx8j+FGbonglcmSoE9F3zN2JN1o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708948915; c=relaxed/simple; bh=n6cj64Or9PbJgGcoTFOmTwi8YEiwtQFw0GN6ev3weiE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=cADsCl0yOBgosZOUEkoDDXVfak0ujywRcDn0+9dpYMHdMt1y/Z2gUrCcvy9sWE3F9K9pDKBax+ImD0ZyWlW/cjm8wBXIjHeVLxpKBih+sdsLd67oS50YqzOXHtvojXX8bZKWFxh/IRHzaDnAIfdwtoHC/gzT7hD3VEX+QNhTJ8s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=WQcV0big; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=NficySbP; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708948912; 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=ssDX0tZ9H4aDFqTnUDa/YmbnpDQsXNRYjqJeEeUC+QE=; b=WQcV0biglPoBwnOItFsCWzHjvUl/N1wVCLQ5nLY9wqZ1XR2725+jHwPkHXinEzxQQ99pYX +sTn8tsf2SJRctmOnAANkkqHRakTEodjojHB0re/Uae21skTs9c6bD4W+9Z0RBiD663x9J tg1jLIgR8PlyjydI0vq4pMOYrJoXEgHzC+Obqrezs8KAHEbAaF1R8VTWCg1jjRZRdPaGBE McFYZTBWyXvaUBvTQznd9vEZz2zA95yUCPysb9dywex2vf9A5X5njTE3xQ5zkfA9B9vXDI Ks6xEwuvh86Ye5CM9MD249m3C4Y1qX9wElppfHozxFVm7zoYMlBpY2vZ2UVYlw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708948912; 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=ssDX0tZ9H4aDFqTnUDa/YmbnpDQsXNRYjqJeEeUC+QE=; b=NficySbPs2/2+86UeilOXLw3LS+2zvXSEFsOG1gj3oGHWghV+YG4FqrrR+scflwoR/R644 FCHoSf3RhRG4EUAA== To: Mukesh Ojha , pmladek@suse.com, rostedt@goodmis.org, senozhatsky@chromium.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH] printk: Update @console_may_schedule in console_trylock_spinning() In-Reply-To: References: <20240222090538.23017-1-quic_mojha@quicinc.com> <87plwo5z4k.fsf@jogness.linutronix.de> Date: Mon, 26 Feb 2024 13:07:24 +0106 Message-ID: <875xybmo2z.fsf@jogness.linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain console_trylock_spinning() may takeover the console lock from a schedulable context. Update @console_may_schedule to make sure it reflects a trylock acquire. Reported-by: Mukesh Ojha Link: https://lore.kernel.org/lkml/20240222090538.23017-1-quic_mojha@quicinc.com Fixes: dbdda842fe96 ("printk: Add console owner and waiter logic to load balance console writes") Signed-off-by: John Ogness --- kernel/printk/printk.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index 1685a71f3f71..1612b50b2374 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2020,6 +2020,12 @@ static int console_trylock_spinning(void) */ mutex_acquire(&console_lock_dep_map, 0, 1, _THIS_IP_); + /* + * Update @console_may_schedule for trylock because the previous + * owner may have been schedulable. + */ + console_may_schedule = 0; + return 1; } base-commit: e7081d5a9d976b84f61f497316d7c940a4a2e67a -- 2.30.2