From nobody Sat Nov 30 12:33:50 2024 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 2E9EE187848; Mon, 9 Sep 2024 17:27:48 +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=1725902871; cv=none; b=Nvz4xCeiwe9VzEswcvGWXuuKnHxURVWlgL4s9NDJWzRXoCnD7TzmsPPjc5BX6fQQh8C0/xo8xBpZi7wVxeUnBoeSGOjJxKK0R/6QscO7ixxNGhej+FE6mUP3oGGIk1WqLFgp4gOt+gheWgeq9HxZx+FSYvnhciHvVavHMeWphUw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725902871; c=relaxed/simple; bh=jfsb6GIAxhz+XyuprzriE8CkIeOeiVyHrVvbKjHgRBA=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=cspWhX7CLhxHQPmPZwRuyMAqrrUfY/6HHdKF+3JFztCa2FqX4ltW0TdnJOsM6FhDu8uJZ43aHq2tqJdcell0uvg0DE3FJq+EhhPWBCk5Bx2Bttmf2mcTExWR/kcjBeJLLWnJiGYLep+BibU7ojFpG2jPg7U7wz1o1CepVDznrh4= 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=UDtFlb5W; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=aYBQmRru; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="UDtFlb5W"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="aYBQmRru" Date: Mon, 09 Sep 2024 17:27:45 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1725902866; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S4gJ7K8qV+Sv+9nfgqu3/MTTh0ldMe2iptH/NMPVCBw=; b=UDtFlb5WtQ5YU9P+wcexH4GTpfhRSFb7mjkfnB7JyNROWSL91PX5SN08LYJzBzmJmwmmML vUwjcfXJorGwgUQiSJexTYnafOQaxupppjoIK5l4aXWt0uRzTnqmoZ/avZf3FOsCY6n0qd 2hTZroueAWpmW7faRtBgcuY4r5jmF8TVDdlOegyOPdDEujNILJf1lkUPCnxdPORjK3lkPH 2tvL4bZPpn1+BtwazdNKIfTbYiUf8dYmBWTu5LGQA8/o0QSGRN4eIc5k1mprRIV8axYuBr UXsFdhZNX9heyPJfctKnrQjTLWITOTzxcQYJ3KsFtonAtJ5aGg2ssKOGVEvC+Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1725902866; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S4gJ7K8qV+Sv+9nfgqu3/MTTh0ldMe2iptH/NMPVCBw=; b=aYBQmRrucsjq5XVZEN7FVZG4Af+hLTfy0IftnivN3QtRdrwfx5S9uywfgJasYg4bY4EcSl o7GVbaUUTgQKanCg== From: "tip-bot2 for John Ogness" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/rt] printk: nbcon: Init @nbcon_seq to highest possible Cc: John Ogness , Petr Mladek , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240904120536.115780-6-john.ogness@linutronix.de> References: <20240904120536.115780-6-john.ogness@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <172590286579.2215.14643543516807543245.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable The following commit has been merged into the sched/rt branch of tip: Commit-ID: fb9fabf3d86216961d1103ecbc33e98d5f6c48f5 Gitweb: https://git.kernel.org/tip/fb9fabf3d86216961d1103ecbc33e98d5= f6c48f5 Author: John Ogness AuthorDate: Wed, 04 Sep 2024 14:11:24 +02:06 Committer: Petr Mladek CommitterDate: Wed, 04 Sep 2024 15:56:32 +02:00 printk: nbcon: Init @nbcon_seq to highest possible When initializing an nbcon console, have nbcon_alloc() set @nbcon_seq to the highest possible sequence number. For all practical purposes, this will guarantee that the console will have nothing to print until later when @nbcon_seq is set to the proper initial printing value. This will be particularly important once kthread printing is introduced because nbcon_alloc() can create/start the kthread before the desired initial sequence number is known. Signed-off-by: John Ogness Reviewed-by: Petr Mladek Link: https://lore.kernel.org/r/20240904120536.115780-6-john.ogness@linutro= nix.de Signed-off-by: Petr Mladek --- kernel/printk/nbcon.c | 8 +++++++- kernel/printk/printk_ringbuffer.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/kernel/printk/nbcon.c b/kernel/printk/nbcon.c index 88db24f..bc684ff 100644 --- a/kernel/printk/nbcon.c +++ b/kernel/printk/nbcon.c @@ -1397,7 +1397,13 @@ bool nbcon_alloc(struct console *con) struct nbcon_state state =3D { }; =20 nbcon_state_set(con, &state); - atomic_long_set(&ACCESS_PRIVATE(con, nbcon_seq), 0); + + /* + * Initialize @nbcon_seq to the highest possible sequence number so + * that practically speaking it will have nothing to print until a + * desired initial sequence number has been set via nbcon_seq_force(). + */ + atomic_long_set(&ACCESS_PRIVATE(con, nbcon_seq), ULSEQ_MAX(prb)); =20 if (con->flags & CON_BOOT) { /* diff --git a/kernel/printk/printk_ringbuffer.h b/kernel/printk/printk_ringb= uffer.h index 8de6c49..4ef8134 100644 --- a/kernel/printk/printk_ringbuffer.h +++ b/kernel/printk/printk_ringbuffer.h @@ -404,10 +404,12 @@ u64 prb_next_reserve_seq(struct printk_ringbuffer *rb= ); =20 #define __u64seq_to_ulseq(u64seq) (u64seq) #define __ulseq_to_u64seq(rb, ulseq) (ulseq) +#define ULSEQ_MAX(rb) (-1) =20 #else /* CONFIG_64BIT */ =20 #define __u64seq_to_ulseq(u64seq) ((u32)u64seq) +#define ULSEQ_MAX(rb) __u64seq_to_ulseq(prb_first_seq(rb) + 0x80000000UL) =20 static inline u64 __ulseq_to_u64seq(struct printk_ringbuffer *rb, u32 ulse= q) {