Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp1096891lqp; Thu, 23 May 2024 08:54:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVWAm3GLVNqDA7E+zoIW8pou12OYsi7hdgSapf30TXE8oX41spUNnSwKPfFz0Y5smEwOksn/LPXGhwkg1hdmQNB9ZEmjqRGcztw3IGxxw== X-Google-Smtp-Source: AGHT+IFzALfN/DboVpRuH7TCKXDDEhD12ZQcGjFkZVN0+ms7qMx/kn7vxy44KozlYlhhC65p2hCX X-Received: by 2002:a05:6a20:970b:b0:1af:fa18:76f7 with SMTP id adf61e73a8af0-1b1f8b447d4mr5174853637.39.1716479664502; Thu, 23 May 2024 08:54:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716479664; cv=pass; d=google.com; s=arc-20160816; b=tRhlzNYKLM6hZOmwA1/M/bOvoEZFGEY0ednaxK5l7AZeNGHPXAlnypGlZvRMRa13Y9 qzGUhJx9P+0ffwwiB03Vm0zeCdyvGQ3Jde3f+XOQ0oYtwczfEbIC+EVUMrStFXWlWv9o n9cubU4cz2YOvqNhrYn3LOLf2AsDdAAep9u+ap3RuX5Qj7d+mmW/FMyumNf4E6s6CnJP UR6sFYo2d/qihtC0pwQU8V1b0MBh5ryMHCtxiCng669M0xoaQ1tMR/zIPBI9jnjKi/d7 4SN5rL9bF2RDcwKJPgRXadvLTyXvNmodlJ/Q3XeuDBJWNFge2oQqJngHSPrYlT5pO/Lf TfXw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:cc:to:from:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:date; bh=R3PfAXpJ7DcHX3JXsIlofsRi9jcjxU9UTntd5FYKhUI=; fh=uxjn6GuslvNXpjT8UthOP5G63QwfOS0URlT+FU2yc+U=; b=nygc27UOm6zLAcMOzIMgREGBJFB9+LfB2Cc0ckRAdlQOHDmIY4BQto/N8/P334tUNM +1On8fDBOnba9cyX/4K3D0HrgCmHM6Ev4D4Pby93KFLzoJZ8RkQupwWdjVucnEfHZy6V QslmSAMG/xLw+7Qz5HISlomRQ/tqeedDNqPQLdDf2meCeo2bsgBANhQ6a2b5W/TWXHqA 0o13IrqKYzE8JyH7aIvJdh3koyASolUPJRIEHSxqUYtrlcT/1lNkUlZ+sUWDcVUXscO3 94nIT4rnOtQ/Z0PmbpyvMsiSL+dhYqyDozRvcVavXQyjGlPj3AmkBOwL0Is0aPBgsQSE +wmA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=zte.com.cn dmarc=pass fromdomain=zte.com.cn); spf=pass (google.com: domain of linux-kernel+bounces-187743-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187743-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-634117192bdsi7904349a12.563.2024.05.23.08.54.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 08:54:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187743-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=zte.com.cn dmarc=pass fromdomain=zte.com.cn); spf=pass (google.com: domain of linux-kernel+bounces-187743-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187743-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn 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 64ECB28688D for ; Thu, 23 May 2024 15:54:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3BDB814A85; Thu, 23 May 2024 15:54:15 +0000 (UTC) Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) (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 D31C71401F; Thu, 23 May 2024 15:54:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=63.216.63.40 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716479654; cv=none; b=MOS9yabakVyQMV6mqcC/RHWmYjm1JRnQ/fzu587G5nQJdcYbsTAyAd8DHkVWbS1ern+Oo+jYES2SFp4jt97Uv13t0b9lccoiXIzGkoiOqxZL0nU4VE4IRa3yt16ArgqJvIqsX2x+u/Ae2czA1xB7PA5hR5pXwGGlEYueAPyKTN8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716479654; c=relaxed/simple; bh=Y9betDNBqCFVsZJxrcEUDGZqwDErzrwnHGGuVKgsbko=; h=Date:Message-ID:Mime-Version:From:To:Cc:Subject:Content-Type; b=dzrVz3425e5VZrUwReuH9fZx4h7MC9wQdiaebY0ATqhQ7xTFZQ4+ald8qeCsmLkr00TlNjNoRxhRHve+u2FWTJgIpTB2meVI8Qq0SomSnVp/Ak6XHgMRP6adCucorEVkZCvp4242PKyGWODAhr/x57Zk21wZcHSLPF/Rf1c6vVU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zte.com.cn; spf=pass smtp.mailfrom=zte.com.cn; arc=none smtp.client-ip=63.216.63.40 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zte.com.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zte.com.cn Received: from mse-fl2.zte.com.cn (unknown [10.5.228.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4VlXlq38Lcz8XrRB; Thu, 23 May 2024 23:53:59 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.99.176]) by mse-fl2.zte.com.cn with SMTP id 44NFrvFY075406; Thu, 23 May 2024 23:53:57 +0800 (+08) (envelope-from xu.xin16@zte.com.cn) Received: from mapi (xaxapp01[null]) by mapi (Zmail) with MAPI id mid32; Thu, 23 May 2024 23:54:01 +0800 (CST) Date: Thu, 23 May 2024 23:54:01 +0800 (CST) X-Zmail-TransId: 2af9664f6699fffffffff57-3b67f X-Mailer: Zmail v1.0 Message-ID: <20240523235401355RFqSAGtIPwMKV39mUulN1@zte.com.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 From: To: , , Cc: , , , , , , Subject: =?UTF-8?B?wqBbUEFUQ0jCoCA1LjE1LXJ0XSBwcmludGs6IGlnbm9yZSB0aGF0IGNvbnNvbGUgcHJlZW1wdGVkIGJ5IGlycS9zb2Z0aXJxLg==?= Content-Type: text/plain; charset="UTF-8" X-MAIL:mse-fl2.zte.com.cn 44NFrvFY075406 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 664F6697.000/4VlXlq38Lcz8XrRB From: xu xin When we're in the unpreemptible context on the same cpu with which the thread of console locates on, we should ignore this console for pr_flush, because it's a vain and always lead to timeout until the console thread get cpu resource. Fixes: e65be5f4dc3ed("printk: Update John Ogness' printk series") Signed-off-by: xu xin Cc: Zhang Yunkai --- kernel/printk/printk.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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); -- 2.15.2