From patchwork Tue Apr 2 10:13:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Esben Haabendal X-Patchwork-Id: 785308 Received: from www530.your-server.de (www530.your-server.de [188.40.30.78]) (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 AF78F5A104 for ; Tue, 2 Apr 2024 10:13:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=188.40.30.78 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712052805; cv=none; b=CuyYTf94REwv5Zo3W5p1eFtcYoqmIuVGOzzP6iBpm1DsnjnCz6fvRLgTZaqMOW/nCr2HacsVZRhF9oMaadXk5AREYrJA94bmSuFIDsBooMH0oFkNu6XpdIfD+2iwMCSbJFJZmkAmo/T4Wr57jsBGXL/Q6WhXSPY4oziY+SyfQvY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712052805; c=relaxed/simple; bh=JIJ4m0beE5jKptYP++AdtVl4SacYbYVy6XtOEgGxMBs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=umjWgfMVBBrPC5U30I1hMwmeBImFtm/ZoswUeWhdoARA1nxmhOH0IcwvhjYSNNnw4JI39ZWXj/ibsLvbathW+HjChe6EKj6zZCbgSJsx0v67aJ/e5dp9EY1ezi1R2iEtUSMbnXUFjpd9Xaj9X13rqBVx6zjq7z7lB0oQKSPLlws= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=geanix.com; spf=pass smtp.mailfrom=geanix.com; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b=OjN0ZSk+; arc=none smtp.client-ip=188.40.30.78 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=geanix.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=geanix.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=geanix.com header.i=@geanix.com header.b="OjN0ZSk+" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=geanix.com; s=default2211; h=Content-Transfer-Encoding:Content-Type:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References; bh=PZWGI8yGQQtvew+R0/SI58Elx5RfY8sEwBlv/wfZEys=; b=OjN0ZSk+1EHSjPL3Vte6EVK0b5 +sNbH9ZkUbAFnX1H/6wb7PqBSa1wjXHd1XYEUgEAXcLg1Dd5rLatOWqYrGnSuGeJGvg8mb0kIlE+A 0K/k8CLWC8Ty5M6Lk1GZU00jzTf+FYn2lnLTQr9KdznhBxhK206FHkDgSzwWwJ+6OZQ7pFqMiLEae LSaHwDcAPTRnOCenwRHBoE4MR5y4laPT7xnYAPjAwx60C5Do7ULCTl2uFG/vASD6FqfgqVOvJAFpg nmDjhSTzDDbnvzG1HZ8HojsKlDZ1NqNrkp2lM1L681q66eoj59fLhnFzBlKUVt/LaqeHmiNr4lpfq VqIsQb6A==; Received: from sslproxy01.your-server.de ([78.46.139.224]) by www530.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rrb8q-000E0E-M6; Tue, 02 Apr 2024 12:13:20 +0200 Received: from [185.17.218.86] (helo=localhost) by sslproxy01.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1rrb8r-000DFG-0A; Tue, 02 Apr 2024 12:13:20 +0200 From: Esben Haabendal To: linux-rt-users@vger.kernel.org, Petr Mladek , Steven Rostedt , John Ogness , Sergey Senozhatsky Cc: =?utf-8?q?Martin_Hundeb=C3=B8ll?= Subject: [PATCH 1/2] printk: export pr_flush() Date: Tue, 2 Apr 2024 12:13:20 +0200 Message-ID: X-Mailer: git-send-email 2.44.0 Precedence: bulk X-Mailing-List: linux-rt-users@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Authenticated-Sender: esben@geanix.com X-Virus-Scanned: Clear (ClamAV 0.103.10/27233/Tue Apr 2 10:26:21 2024) Message-ID: <20240402101320.p-hTtljghBK7LvvifHYbcUQD11_pC8afj1_g2QsF2l8@z> From: Martin Hundebøll Outside prinkt users might wan't assure whatever printed has reached its destination before continuing. E.g. during the shutdown-procedure, where printk-buffers aren't emptied before the system goes down. Signed-off-by: Martin Hundebøll --- include/linux/printk.h | 2 ++ kernel/printk/printk.c | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/linux/printk.h b/include/linux/printk.h index a2d40a637226..c8ac0f17d828 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -142,6 +142,8 @@ void early_printk(const char *s, ...) { } struct dev_printk_info; +bool pr_flush(int timeout_ms, bool reset_on_progress); + #ifdef CONFIG_PRINTK asmlinkage __printf(4, 0) int vprintk_emit(int facility, int level, diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index e29f77f4f8b4..26a63457ba6c 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2484,7 +2484,6 @@ asmlinkage __visible int _printk(const char *fmt, ...) } EXPORT_SYMBOL(_printk); -static bool pr_flush(int timeout_ms, bool reset_on_progress); static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progress); static struct task_struct *nbcon_legacy_kthread; @@ -2505,7 +2504,7 @@ static inline void wake_up_legacy_kthread(void) static u64 syslog_seq; -static bool pr_flush(int timeout_ms, bool reset_on_progress) { return true; } +bool pr_flush(int timeout_ms, bool reset_on_progress) { return true; } static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progress) { return true; } static inline void nbcon_legacy_kthread_create(void) { } @@ -4217,7 +4216,7 @@ static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progre * Context: Process context. May sleep while acquiring console lock. * Return: true if all usable printers are caught up. */ -static bool pr_flush(int timeout_ms, bool reset_on_progress) +bool pr_flush(int timeout_ms, bool reset_on_progress) { return __pr_flush(NULL, timeout_ms, reset_on_progress); }