Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp1416559pxb; Fri, 21 Jan 2022 18:11:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJy9paaIniGUSO7XjleEr4xUoQE4YVG5U5M8NUiSEQREsVyed8Y7rQ23OeBRqYR6rZ4L8FCH X-Received: by 2002:a63:bf0a:: with SMTP id v10mr4716656pgf.404.1642817513215; Fri, 21 Jan 2022 18:11:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1642817513; cv=pass; d=google.com; s=arc-20160816; b=KLvPNUarAOWQsTtiLoaSC7gjowg7FF6ZCtKh/P9E8G/wMCVtnUqXbvuSQvxSIS8LY3 jcrKEBBU5IhAVfs0udYG6klFRg/JpLMxgW4xqONM/xAaWduXyTsxckCm/V8gcEuMfER8 wRhOEBhxNcCkd6FVMjJVJxNEpGbxtUZtGM0B0MCq2H3DSZ2eYz221qMt+QH2Vzzch83Y +XD1MjBbHo/DxSasX7mKSrD3J8lwJHQZ/FjpcShA+Zpgs6RZuDVyIMaEYR1oEFzdHV+U Dd0a3+mLggY642iWccLbxXe1jVMGnB7vZ/q/jfH1kdFekn2S/lpscV+S+4JeoSCXxPK7 P1bg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=0L13pwsIgGoVT4ayl7ss4kDAewGzM7aPF32rYuNhKUg=; b=QtEUpYWAocFuZ0AKKMJ0rZt7fb/yvMOZDeRlg18nc7ef1pv9OPrU+3S4CUtRC7u4c0 YRa+cYz2LqU8eQCoFSqPHQeGpsDOliYjQGiQPLkFgUcv+HurcvxD7n2rWG8eLcY3RId0 yEVF5pGNHhPttTPC/QU4hbDOM9sNRE/fZOKxg1T4/YPealvqNr07/4RXgIE2rI2QM1Yy PVUIWwtdIRFXaF/6sD3qSUWoncOG1GfHzp796iVxRd1BQD+jK/VABRoHaoT+qS1g9OHS zvlE8vRtl5AdrNFIqAmdJDQRHjeAojUc7fyModGEr2gIybOVPxXEIqePvud53yl01TI+ +zrg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2021-07-09 header.b=mYDxuXUs; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=EZ4qBYOk; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x11si8815890pgl.231.2022.01.21.18.11.41; Fri, 21 Jan 2022 18:11:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2021-07-09 header.b=mYDxuXUs; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=EZ4qBYOk; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231753AbiAUTDJ (ORCPT + 99 others); Fri, 21 Jan 2022 14:03:09 -0500 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:6944 "EHLO mx0a-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231558AbiAUTDD (ORCPT ); Fri, 21 Jan 2022 14:03:03 -0500 Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 20LGxFSP031049; Fri, 21 Jan 2022 19:02:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=corp-2021-07-09; bh=0L13pwsIgGoVT4ayl7ss4kDAewGzM7aPF32rYuNhKUg=; b=mYDxuXUsZBUcw1aU7MzUZYsr8BnAwUmGxY9v7Uz+Y+0MeIgVhhPAbho5ISKNOk6i2r20 Z9qnDd0egH+PQJw9KcBZicISNk3SNt7ymtwxSHpnOJEbwnvtPNQhhVgx2wINzxuJkh+P MhxTSlCjaH3VEgi7DFuhVChk9ZAoPHglkhyiTCTPwho1K1Z5K1jaF7Tx3KPcRpZdYJiR MW5E6UH0lccbp/7jfMnemJvcaZVcszT4+FwZUMDVxF5G8M25r7dZ/nMwc8Ux7oaQdAsC V6+3GlMqiipmACA7P15Su4zXrIyBRI9cHOME64Ojy1cb5tTQV+teqoIqWhtqgOU74z1l iw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by mx0b-00069f02.pphosted.com with ESMTP id 3dqhycjaak-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jan 2022 19:02:40 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.1.2/8.16.1.2) with SMTP id 20LJ0DmB181197; Fri, 21 Jan 2022 19:02:39 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2104.outbound.protection.outlook.com [104.47.58.104]) by userp3020.oracle.com with ESMTP id 3dqj0nenad-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 21 Jan 2022 19:02:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=eRHOBu0/cp0ka1WpPMHMsHHWCRhv+JAG+GDdQD4+2YJKpdBFr6sh0QKMhUWbOqWG6NFM173JFXM8Iv2mj2JnFgxBKVOY1/EHGla2kK/p1sktIuB8NAgoUZOctUOhQcwkqkKVC/WP3T+iOpL0CYFisW+MQ0UmJ2JIKcq8XPky3uT39xmIW2vUwY2+SciRInOi46TBShV9w9I8fP0S+mVYJe7d1qvt4MNb+v01n6txb+TyEDBngWd26yjIB5kBD8/iTT25UXL1sngqskEUqwW5zoJxOx7SnHQTm+y6ZPvmuECXl1pO8FaQtEdGL+IMa0KVH87t28jD7RsfQuHi3tOvjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=0L13pwsIgGoVT4ayl7ss4kDAewGzM7aPF32rYuNhKUg=; b=XHmgIpWQh2SVcAKFUaGgvNpdZR5q2bbCvKpP7Zk8pAfL7SFY8I+qPjzzI1QhVoau4uy9xw7WnhCGweYsa3XyDgzXQt7EoIx9ux84eRhPs8vD3U2JGqttSax3rTzs5i0UlqlD5o4yk0tVuhzI5nC/IbksNv6kgRkGcT97wcKl9l5BYHG2UJ2bHsgBwSQiol8+oJ/+p72Q5nibFMjuah3jl+K5Fo7lVHyTXpwNvMpZESUoHCco7YXkl6KciTGwEF+HqEThjvJLlfTKVCpP1W3tzErkiz1iXY9IDvnykkxbX2Yuuko72dR7oIyt55ct7nGvl5tZboZxZ8MWybwXjJSURw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0L13pwsIgGoVT4ayl7ss4kDAewGzM7aPF32rYuNhKUg=; b=EZ4qBYOkzh5+fHAjlAvfxFbTLc4na2YN7innd3CRDiGSEw3Fbw9imzknOHLATWmsq+N0dtWx9/wG6vxB591Z8r2nL3rI23iJ8NkhsDCMNIUDibHpDJFsHw0/yV6ymTSyKfZSERbVbqtWMaw+w+GIJc4DTdbJoKxb8V6bJGxxueQ= Received: from CH2PR10MB4166.namprd10.prod.outlook.com (2603:10b6:610:78::20) by DM6PR10MB3434.namprd10.prod.outlook.com (2603:10b6:5:6a::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4888.12; Fri, 21 Jan 2022 19:02:37 +0000 Received: from CH2PR10MB4166.namprd10.prod.outlook.com ([fe80::f4d7:8817:4bf5:8f2a]) by CH2PR10MB4166.namprd10.prod.outlook.com ([fe80::f4d7:8817:4bf5:8f2a%4]) with mapi id 15.20.4909.012; Fri, 21 Jan 2022 19:02:37 +0000 From: Stephen Brennan To: Petr Mladek , Sergey Senozhatsky , Steven Rostedt , John Ogness Cc: Stephen Brennan , Sergey Senozhatsky , linux-kernel@vger.kernel.org Subject: [PATCH 4/4] printk: Drop console_sem during panic Date: Fri, 21 Jan 2022 11:02:22 -0800 Message-Id: <20220121190222.572694-5-stephen.s.brennan@oracle.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220121190222.572694-1-stephen.s.brennan@oracle.com> References: <20220121190222.572694-1-stephen.s.brennan@oracle.com> Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SA0PR12CA0024.namprd12.prod.outlook.com (2603:10b6:806:6f::29) To CH2PR10MB4166.namprd10.prod.outlook.com (2603:10b6:610:78::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 74a31c96-226f-4ffe-0f69-08d9dd109726 X-MS-TrafficTypeDiagnostic: DM6PR10MB3434:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6108; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: TEyqV60jNw32j274nCW8Jj4GU7T23JioZLDo6yBkOTVdN4J/QtjkSv5ulEXeum+LMU68FBUdqioSFfdFuGah38P3/Jt5JvD4TQcMdhl4tMs59GNJGYd6q1A/fQ8ghYYnxixcTCxoByM7+dvVeyvOVF43nVtVPotbBUlPWOixhWv4+kv92qkXOriQxlNirUXEqC5u3fSEzQXNETlKUhHrycDTf2n5UpIEiYI/A3sqRQgqrJduspwlmXctAChQDqESQR3QORvhY9am2PuuyNer6hCOFbkDwr1c2RlecO/FvDiXn/9YBCpWb6CmiilRet0S7rUKbYb4GykU9DQ3pPCHDIVYqPVpLueuVmkOGVZQNhFrcivykXmjjVvR5fBJKbCSXfUagfUnaVWOlk9BgrhOeIe/4wNWLC0AFfcT5o6QsO6/1mqVT5S4GP0V2POabxDtuGStgTp70eQXaWZuZMha1LHdsOBUDFRIeuXlSkQnZcBAYOSpJp0WDvPasdfQCaV+tqfw3fpBMV2nb8id3xB2pB41+9USzZenrExsZIzvgE/QgOu/PymnQ9hkZ3cD12zywgExr5fsrPjOA+0vUMjJ3Dr23wTM5CoAz2o9egZgbBAG8T2jK0TYml9TAYa9fRUOMplGHZPZgEqQhxqfpkHkpxZFslpoZH3jZHBnWpnp1Pxvl0HbUcsvQ9EamWVnDeJQ7rkd95P3yjM/wc/oKAaZog== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CH2PR10MB4166.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(2906002)(4326008)(316002)(8936002)(54906003)(5660300002)(103116003)(8676002)(38100700002)(6486002)(38350700002)(86362001)(110136005)(508600001)(6512007)(6506007)(36756003)(26005)(83380400001)(186003)(6666004)(2616005)(66556008)(52116002)(66476007)(4744005)(66946007)(1076003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?3uE0KKRr7tU68QkiEMzd6T06qG+Vi1aYkuCn1aul4PQLlXEcsX6a6u/vqHHW?= =?us-ascii?Q?bTtSeE/RYVwli/e3mIPuOqLg+NJ08ZP6cSxnGpo2PFp6RzaczFFuxePXNw8g?= =?us-ascii?Q?fnFkaaCS+/5qTaEwbFcoZ7UJFJPIzzSiMCsdUDnB1jbII5jqO6iETGqZNzAf?= =?us-ascii?Q?KIuqosQ1f0AJBP0G7cEFBhi4h5CJMsksDpn0/ST1OYzQWU2pSSjyul67q0pN?= =?us-ascii?Q?A1NACU0gT05a+FHzNXAyGqtVfDSQXxNUwDdAlBB6bMDPm5wgrBuWg/GG32nZ?= =?us-ascii?Q?+yJdWGxagpIRpQFS95QMCcQ3xPT5j9MzQxFLqgH6qP+dOWx7ZqKgXGk3H1Rd?= =?us-ascii?Q?rlXG3VX9/Myf0d/QROzZSIdqXu1gDfOwzosJ+KEFocwHRAw5fbmWbjWNzuFR?= =?us-ascii?Q?Vr6bRfYSpJUPwKjgIcE/X2v/lE+VVRxPgg0odBo2ONCKRfz5O7AY63/HVmiY?= =?us-ascii?Q?TWuDUAnUgxaI+fnu/PtuEEukwJ2b1xJrz8ocM4nD+axoegaLNj1hD+HRo6h9?= =?us-ascii?Q?V2qwRQ4IxlVbbVZ5xdO2jNiAhg9JN41r5m1clh+V1/S2oS6i76byrQTPovZe?= =?us-ascii?Q?AWBe4FCPMVaevt50LTZFWoJP/MibZwu0/gSAUhaF5LY4lFpiibxtHIe9l4lt?= =?us-ascii?Q?0nHKjJVXxnXuNonTpdHVrlehzOgQ/jQZjmYgHb6JHaeHsg5x53vdJH4yLULz?= =?us-ascii?Q?WUcKkETar9x+SXXJsZBTONlFEFIcpeziYOYfqHEGfS5cKS9g3WkhKzibny1p?= =?us-ascii?Q?XfOX5Yd3E5+KTwnmybI4AIEoby6RCwgf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3D=3D?= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 74a31c96-226f-4ffe-0f69-08d9dd109726 X-MS-Exchange-CrossTenant-AuthSource: CH2PR10MB4166.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jan 2022 19:02:37.5954 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dSCrsduLmf8mUCA2pm6WKs0M/qDeRBALRI+dLZEOZx+PtudL2RaVdBKIq6CRA9hxwpvl2bVq3WT6UL7e6LKH4D1gMz80rb0jzW5nGQeCDK4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR10MB3434 X-Proofpoint-Virus-Version: vendor=nai engine=6300 definitions=10234 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 bulkscore=0 spamscore=0 suspectscore=0 mlxlogscore=826 phishscore=0 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2201110000 definitions=main-2201210124 X-Proofpoint-ORIG-GUID: 1kHmDSndQWwlKHBis7vndhf1egauh7zq X-Proofpoint-GUID: 1kHmDSndQWwlKHBis7vndhf1egauh7zq Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If another CPU is in panic, we are about to be halted. Try to gracefully drop console_sem and allow the panic CPU to grab it easily. Suggested-by: Petr Mladek Signed-off-by: Stephen Brennan --- kernel/printk/printk.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index ca253ac07615..c2dc8ebd9509 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -2668,7 +2668,7 @@ void console_unlock(void) for (;;) { size_t ext_len = 0; - int handover; + int handover, pcpu; size_t len; skip: @@ -2739,6 +2739,12 @@ void console_unlock(void) if (handover) return; + /* Allow panic_cpu to take over the consoles safely */ + pcpu = atomic_read(&panic_cpu); + if (unlikely(pcpu != PANIC_CPU_INVALID && + pcpu != raw_smp_processor_id())) + break; + if (do_cond_resched) cond_resched(); } -- 2.30.2