Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp223001lqs; Thu, 13 Jun 2024 08:21:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUxdf9T9ICnLiNt8qAHq6Eii3pvTK1Jor272JL7cuo5nfhl5/Y8PX5LXTxQuDSzXrx1ToE/jbbOusWhlkssl3yZD5oCCNBTpcyZ5YCLiA== X-Google-Smtp-Source: AGHT+IFO1S8o1QnwzSA4kMFLJo4ycsy4iUFwHA4p8rStI7bopHeXOYU6dxdfmtrbOv3pPF73G8ud X-Received: by 2002:a17:906:5f9a:b0:a6f:4bc1:2764 with SMTP id a640c23a62f3a-a6f60cefd3bmr6917266b.10.1718292105694; Thu, 13 Jun 2024 08:21:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718292105; cv=pass; d=google.com; s=arc-20160816; b=VpjDia2fouhId6cksTl0a5nEgAaxgmG7xX7tRwO12dMnc6EuAG1MrJNk23yP5k6GBf vnvJ9GFPfCIiUiZzUXyl+t20eBUl3qc0lVswtlzQJYHeolGJpWSkdPRhauerK9a04Mn+ LbTkAg3rvQP10hOzKq8Up1op3IdHcDQe/XY0zZJ0QHZMD9OYmD0a9fNvBQaJ9B3C2iO9 6Esfxjwa1raj/Zbtirue7SvFKyIAT0RjowbBvpikCHkarNOLT9fHouS1Jx64ftc5RQNM dOFyBoJ7IPmF6hpiDbE3NmSiBSTE3uFn7Y3BJGCBy+hzsPgI7NJJi8zNAHsI6sbck1KS e+nA== 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=aywo/MKB8or5V5hzcLoPZZQeZHEBi9nR93fDmZDQq5w=; fh=/NZX815RJy/ecOe1WbZ023sSZUJKZnpaeIZwQG5Ym7U=; b=IY3+RNmL26TEf9LpK5GRPykZ1SXdsvYeZ185Aoq1NiZgEUJDwMiK0y3g0C8HhiDZC8 eibtu73Ncjbfm31OdspUCXD3UDt9yD/lO1LqpIEN/RDzTEpCub2PDiZ40LeY+U/lsUtM TIO/KbhtmJk/DkYIfs0Uz188u831tpRwWgkBuZeZ1GSAUOh7lquubx1sl+VOOuTso7S6 EsvTBVp/52zWodppT5yax+cEVQqgL1lGF3Q80k+HaNSls3ZMJ6JxS02PsiyrR3vegPe6 /t8r2gew3UTREG/GB/GIwahwYQEmVf+x+bgv2FPHb6OTIPOC/TpIEMB5Bq2jxzT1WzrJ SuZw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=pnEt3aK4; 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-213528-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213528-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f56df80a3si77215166b.655.2024.06.13.08.21.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Jun 2024 08:21:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-213528-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=pnEt3aK4; 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-213528-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-213528-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 6B7AD1F21FB0 for ; Thu, 13 Jun 2024 15:21:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 222811494CE; Thu, 13 Jun 2024 15:21:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="pnEt3aK4"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="qleynsmI" 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 01AA213CF85 for ; Thu, 13 Jun 2024 15:21:35 +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=1718292097; cv=none; b=rXZ56Mpl8yjxR2FS169DH5hjyHi8GJr3DVxD3JO+0haWJ8kxqYV5jqP07re1bSAxYz7hvF96AULR6BpAbO3vwdHoFq01c2wVwtrluRBJoZX1qsSOKecbge5Ga4lsGz8tYxxuN18OecTBZyxhuyn1nvozA12NrSPoVzd65dZJ1m8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718292097; c=relaxed/simple; bh=iIrB4ExCt8BUVfEVtMt1w8/a6BsbAd07dBKrkPoLw6I=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=ErBKxstcM9SXuYNRnm1OhLM8ycULkMByV0Q2KGUJEa84xGeREywe5mQXWzPdjbtaxcj9IFqQG8BaD3Sq7yNc9ADLKQ9H6ZrwBTvPqyUT7r5rJ9ZYa+xBw3PRqqvDCdzHsJuKM3mzl5+akyhrVX+QfFMyRtQ/ilKC6w0N1b3rNP4= 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=pnEt3aK4; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=qleynsmI; 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=1718292094; 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=aywo/MKB8or5V5hzcLoPZZQeZHEBi9nR93fDmZDQq5w=; b=pnEt3aK41An9rW+8tAxPcg825WB3bQmcfTIzxyILP/ZYNrVk+ZCW2dBBfdN5PT8AOr234i D+ksfgnMw6QtWUSFiCRUEyG+e6fv4zVy3eZtMXAuyfu5sxrr7NpOA+JsQubolrtOg/aiGv +nZIwYWUfK+Ga4FVmFf8DPYv+Vc6a+n9tRxsA01FieI5sLdbea+aw1Ve9GpMyChVJB2WWb SjG5FASwSUbHIsdgMINAfLbD4E8wbZVeGR31EtwQU1HT7MPO6nqyPmwVITbYHLepXuEuqx 2aVjqjonOVx4XTmbDRR0iQjwvGwrnYdA4k3TXI1NIeiPJ1x/avJy3qnL01QfSg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1718292094; 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=aywo/MKB8or5V5hzcLoPZZQeZHEBi9nR93fDmZDQq5w=; b=qleynsmIUAOWSmvsVv020dVUNcecZsvrchPTOFh1hZPGQfVdejRJFmnfsC9tjkCLWZQX2Q ujHqEC5FsiJBmZDQ== To: Petr Mladek Cc: Sergey Senozhatsky , Steven Rostedt , Thomas Gleixner , linux-kernel@vger.kernel.org, Greg Kroah-Hartman Subject: Re: [PATCH printk v2 04/18] printk: nbcon: Introduce printing kthreads In-Reply-To: <87sexipmrk.fsf@jogness.linutronix.de> References: <20240603232453.33992-1-john.ogness@linutronix.de> <20240603232453.33992-5-john.ogness@linutronix.de> <87ed95j8yh.fsf@jogness.linutronix.de> <87sexipmrk.fsf@jogness.linutronix.de> Date: Thu, 13 Jun 2024 17:27:33 +0206 Message-ID: <87jzis50n6.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 On 2024-06-11, Petr Mladek wrote: > Honestly, if the system is not able to start the kthread then > it is probably useless anyway. I would prefer if printk keeps working > so that people know what is going on ;-) I have been looking into and thinking about this some more. I do not like the idea of the system doing some sort of fallback if some of the kthreads fail to start. Not only does it complicate the code, but it greatly increases the variants of how the system during runtime. I (strongly) suggest the following: - The kthread is created in nbcon_alloc(). If the kthread fails, then nbcon_alloc() fails and the console will not register. - nbcon_kthread_should_wakeup() will return false if the console is not registered or if @have_boot_console=1. Then there would be no need to ever check con->kthread. Instead we can rely on the global state of the system transitioning to relying on threading. I think it is totally appropriate that register_console() fails if the kthread cannot be created, just as it already fails if the kmalloc() for the pbufs fails. Any objections? John P.S. There are other minor details involved, such as calling kthread_stop() before removing a console from the list. But I have gone through all these and it appears to generally simplify things a lot.