Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2459485lqb; Mon, 27 May 2024 23:40:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWlgei+8QUi61BR3pRRNMm8KYLVMUMZ03lbm7aji5rgfE9ay77YUmVyVHXPvjnpI8K4n4nWzyeevL7qzH80HXwzwFklIlD2+4yBtSkYrw== X-Google-Smtp-Source: AGHT+IFdKCjUCvycrWg08xMZxBHpmT+9YTrJ4pt97SOsMDrgrnNBhAF4ylREpiNWzVuI3tUtpdZz X-Received: by 2002:a05:6a00:4093:b0:6ec:f0e7:d942 with SMTP id d2e1a72fcca58-6f8f41a0ff3mr12475103b3a.28.1716878421829; Mon, 27 May 2024 23:40:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716878421; cv=pass; d=google.com; s=arc-20160816; b=EraaaSSAIsj8mEIkktTev9irs4PPSq6MoUjPLxHtIjKGM2SbMF2I6a1kfyOTUDE48X cpnoUJP0TmK+jmsRG/yob5BC+nVWOh1i1QuPSIAmbI/DCtX8mpvZMHiBeOcOoucpOP+w EA+SjVywFLqk3iDraEWhPG32+rWfNscv5M1ywbYs8JtA/i1Eka4xq1w3PtXjvO3XtqhH ZUblbT2kKlFYr1FAqZTKdLcKiyVb3R0w7KKnk61wBO+5Wj5kx3f5QoVCcFJO9V6PMJro U6DsEm9TrEwqtGCmgpgdmwYTMY6oX/zZSRQoTdIaEfInLXqgeksdTOtd8e7Kcubs9RqZ EzaQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=GyT1AQYmZjQqmzbCWjENPJaJCrng/s09BLOsFY4/P2o=; fh=KXowfl6mexX8n8VfGj6Ya02GVTUDqA9/TkXQ0jJurko=; b=B+jaUDHWcPIt0Rx6whTlxb6Q5U0Rw4ZPuWlOucYZYSLotM+3UzcNyS2mOGo4P4z0rk 1Nd36ONmd3QSAUUda+KufvoELoJpMvroX7CeT5F+bVwwf9PdIfiGldfPdVQ5yOV3X3fk QqEvkAKSjlE5/wRZi9Eta9a7oAokY1Bi1tezAU9ScXs3dWhh/ymfBGq5nXGP+jSe38rn hL1O6SYQE9yqRvIssznO1dVkWgCswLPRCr1O1ZGfqEliwBNs0MqVB45fRgdKofDh0XkF Y4HJThSV1eOHCeFmfm5am3rAEE7o8evayDUZCzWTMeFkfTPvzD/b3aMGVkoxCslNJ3Bx XgYw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=GW0LnRHJ; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-191817-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191817-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f8fd4dc5b4si7450262b3a.292.2024.05.27.23.40.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 23:40:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191817-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=GW0LnRHJ; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-191817-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191817-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id B39C9B22720 for ; Tue, 28 May 2024 06:40:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD2036D1A9; Tue, 28 May 2024 06:40:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="GW0LnRHJ" Received: from mail-pl1-f195.google.com (mail-pl1-f195.google.com [209.85.214.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A7BCC61FC5; Tue, 28 May 2024 06:40:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716878413; cv=none; b=C0J8l/xAcv7Axqx5I6ZuViqGaCQRDbXFGaC1S2xlNXy6XwJjKWMhPvBweoI1ap/1iIzSLCAdkhNFXxTSsgTJ9hv5alxSOzYU6IPArAoFx297HO/qF29VpdkbXIOwDAMmd4Yfp5QHNC0SwhPMPUJYF9rHIYJoa7sezk7vuKS0sls= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716878413; c=relaxed/simple; bh=L1uIjANRuY9eh6UNDVsTMZQL6aVuyTCCg8ZM+/uJs4E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=LvgIGpY6fseFv+JHOc625Gie6x8ijO5w5v5dMhekxaHo7eDbm/m9/jDfB+4REHLrfW+pVrk7eFepS0HRvxleeXlrTV3BnG/KlwvkiuJ4yw81ZWeLf3RRHf4nz8DyebSCvAfedSbHARZPaWsVrlQKiJpJ85ASdnJ/4kq/vs9Ph8s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=GW0LnRHJ; arc=none smtp.client-ip=209.85.214.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pl1-f195.google.com with SMTP id d9443c01a7336-1f47f07acd3so4206685ad.0; Mon, 27 May 2024 23:40:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716878411; x=1717483211; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GyT1AQYmZjQqmzbCWjENPJaJCrng/s09BLOsFY4/P2o=; b=GW0LnRHJYQaMvQlr5Bjm9jwqQZ9j1XB0c8r1ZaPAODYl9+0671Z6cnAg1Wactiimlx vhjTqJyNP1tLwAbd8QLenNrf9a+MWYRUs2uh88eilXADvG834DjSYkV1AaoKdggoilca VUXBShgYK9ufU8JAk+XS//FfSz1tcvuO8NKMBu3REUYb1UvYQmO4hjF2QqKdKvWqUyEQ CdYU+9gGCWFa8SB81GFM/El5P0KtzX5X8oJjkj1PBe4wsJXfZzvF2TcCHX3sbgt8H1QI a2IsTf8XLnYDDu2mRTFAVjbdaYl45VpCOeb8+x4horB9iZfT0eGlNfe1bt2KLeRH91pe LYBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716878411; x=1717483211; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GyT1AQYmZjQqmzbCWjENPJaJCrng/s09BLOsFY4/P2o=; b=hEDfAGtHj9IH67LB5faArQ2q/r6RrWAPE4QkSmWFyZjRIRX4JBUB+CHChA9BmoNmUm dSYPVp0C7rG2OTdtHTikVrbYAW6hqZiRwPsDs3YCgHECpezjbgmrv7KI4SahRxT/mSKd 3lPebONfsNMyvWW7OhLrH59qsdfcOnyl9sgwW2A2mpb/WCKgxHSWSaKpZAcW6ro5ybuK w/Zb+tY8lDa4g1lmFf5K0n0NOoq39dUXKXfK9DQE5Zjl7t9T53TSQRs4CwGLM4jdb5UL BGVKyWb0VyrQRS4F+ecIG7tT2ooyID+1ogufX0AcqZHKa7SIn/hBfqW78e7/BUsZYqPd dg/w== X-Forwarded-Encrypted: i=1; AJvYcCXlkiIvBD2z9lUmK88jrU1JelwpyqBMNDHrZ2StBeOXsgn9oXRqwWVO3uVCs+HCOsTzRwfeMKImHpfkRnD8VAl+lIxe1+hiSaEUOTJ1ir+e3tOnlM983Pgw7M5C0RYlsPlMgzgTxm3GSIbxJYc= X-Gm-Message-State: AOJu0YxxttPOuiRXzReqz5WnjbXjjNhk/6W/s6BeE/IgMZ/KQ6qX49Wi 2ZSQMUGeulu3VCHcuopTZAcbg8nFMYELNRdFzHP+b+zBcOvHWjM5Do5jHG1K X-Received: by 2002:a17:902:d2cd:b0:1f4:5685:b159 with SMTP id d9443c01a7336-1f45685b4f9mr129964065ad.31.1716878407789; Mon, 27 May 2024 23:40:07 -0700 (PDT) Received: from localhost.localdomain ([193.203.214.57]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f4a77a4047sm25782125ad.255.2024.05.27.23.40.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 23:40:07 -0700 (PDT) From: xu xin X-Google-Original-From: xu xin To: xu.xin16@zte.com.cn Cc: bigeasy@linutronix.de, john.ogness@linutronix.de, linux-kernel@vger.kernel.org, linux-rt-users@vger.kernel.org, liu.chun2@zte.com.cn, rostedt@goodmis.org, si.hao@zte.com.cn, yang.yang29@zte.com.cn, zhang.yunkai@zte.com.cn Subject: Re: [PATCH 5.10-rt] printk: ignore that console preempted by irq/softirq Date: Tue, 28 May 2024 06:40:03 +0000 Message-Id: <20240528064003.776618-1-xu.xin16@zte.com.cn> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240523235537910_yxfGMbTcSOmMkcfuK2d8@zte.com.cn> References: <20240523235537910_yxfGMbTcSOmMkcfuK2d8@zte.com.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit > > diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c > > index 7f27cfee283e..faab85dd4439 100644 > > --- a/kernel/printk/printk.c > > +++ b/kernel/printk/printk.c > > @@ -3735,6 +3735,14 @@ bool pr_flush(int timeout_ms, bool reset_on_progress) > > diff = 0; > > > > for_each_console(con) { > > + /* > > + * When we're in the unpreemptible context on the same cpu > > + * with which the thread of console locates on, we should > > + * ignore this console, because it's a vain. > > + */ > > + if (!preemptible() && con->thread && > > + task_cpu(con->thread) == smp_processor_id()) > > + continue; > > if (!(con->flags & CON_ENABLED)) > > continue; > > printk_seq = read_console_seq(con); > > This does not apply. > There is `may_sleep' set earlier. > > There is no console_lock() around for each… > Sorry, I don't get it. To clarify it again, this patch aims to solve the useless waiting of pr_flush when the console is preempted by the current irq/softirq. This has nothing to do with might_sleep(). > The other question is which kernel started enforcing might_sleep() for > pr_flush(). This should be applied to all kernel or none so we don't > have random behaviour across kernels (5.4 yes, 5.10 no, 5.15 yes). > Sorry, my understanding is that pr_flush didn't start enforcing might_sleep(). This patch can apply to 5.10 and 5.15 where the problem exist. > This is a delay of max 1 sec during bug() and panic(). Not sure how > "critical" this is… In some industrial control scenarios, bugs and warnings containning a pr_flush delay of 1 sec is very critical to the upper services. Especiall for watchdog timeout(< 2s), just WARN can easily lead to system reset, which is unacceptible.