From nobody Sat Nov 30 05:51:10 2024 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 BF5367DA88 for ; Wed, 11 Sep 2024 11:15:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.163.158.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726053356; cv=none; b=bpLcNKtzWWUy+T/3Nj2G/EJMeHsk3cEoE/3uQgU7plsO699wpYZLKKiJeqOiDACXBFuH54h8ginB1IeMqWwoShkL/cdJAGMKa1cs49pnxkoiDE5gWKOuCrplDGjLFO6rqkr2ogO9LJvzTn6sCGwe0dfVeRUlqu+TPK17bPqPIG8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1726053356; c=relaxed/simple; bh=zQwAEp+zV4klBBuiWd/m8n8HOGKjm9KSJPLeO28Ng0M=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=SY/5CAqRscHUmpgsE1NiAumUPC0SrBsbAMenPmo3a+W/tFnU3qPEk1d7UxMeGNI9VF+9Y3Q/aNiJ2kTM4rGh1/zqxDC6ZitGGio2uQ4z66lM5qMwrXS0l6chKF4ae55OeZgMCzzFGQ58bGRaHkCNcwldU30S17Zzv9wutDDpi+8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com; spf=pass smtp.mailfrom=linux.ibm.com; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b=g+9mKXIF; arc=none smtp.client-ip=148.163.158.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.ibm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ibm.com header.i=@ibm.com header.b="g+9mKXIF" Received: from pps.filterd (m0360072.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 48B7JqCW028394; Wed, 11 Sep 2024 11:15:38 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from :to:cc:subject:date:message-id:content-transfer-encoding :mime-version; s=pp1; bh=Wp2GsN0eV/Isimo+fx+sy80p+eNfCNRoPfy1GC0 Wgj8=; b=g+9mKXIFOQ0UCLDq6HB3/Bzz7mILPqulbYX/HTPPt0Up6XiXH6yL4js HlOLkq9ISsn6gF19d09SaLtO5v8BA0q28HZM44D2UKWaFwtuh61pdgcosS3srBpG 6aWiBjkp5UYEnxhiW563ufP+3npsV+rBSCm3OwJaOjvM+SOb7Zsp5TDJqbxTpZvO 1IxvFjIGV2i97mFd8JRAM3pHQCphIAiz9B6BSNSdPJ66h+oBEJArOJWdX77tKtCr cD2Ap/96khxg7zr66o3dw4H5yugnCjiCWg4I9PtzykpXUn8lvMv2rXJZKg40xDgS Hh8bagItolcIS1/3FLzRbfUygsNJEpQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 41gefyn1n2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 11 Sep 2024 11:15:37 +0000 (GMT) Received: from m0360072.ppops.net (m0360072.ppops.net [127.0.0.1]) by pps.reinject (8.18.0.8/8.18.0.8) with ESMTP id 48BBFbqG025638; Wed, 11 Sep 2024 11:15:37 GMT Received: from ppma23.wdc07v.mail.ibm.com (5d.69.3da9.ip4.static.sl-reverse.com [169.61.105.93]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 41gefyn1mu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 11 Sep 2024 11:15:37 +0000 (GMT) Received: from pps.filterd (ppma23.wdc07v.mail.ibm.com [127.0.0.1]) by ppma23.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 48BAaIGw032103; Wed, 11 Sep 2024 11:15:36 GMT Received: from smtprelay03.fra02v.mail.ibm.com ([9.218.2.224]) by ppma23.wdc07v.mail.ibm.com (PPS) with ESMTPS id 41h2nms01c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 11 Sep 2024 11:15:36 +0000 Received: from smtpav03.fra02v.mail.ibm.com (smtpav03.fra02v.mail.ibm.com [10.20.54.102]) by smtprelay03.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 48BBFYVB51511696 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Sep 2024 11:15:34 GMT Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 58EC02004E; Wed, 11 Sep 2024 11:15:34 +0000 (GMT) Received: from smtpav03.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 418C320040; Wed, 11 Sep 2024 11:15:31 +0000 (GMT) Received: from li-4f5ba44c-27d4-11b2-a85c-a08f5b49eada.ibm.com.com (unknown [9.43.116.75]) by smtpav03.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 11 Sep 2024 11:15:30 +0000 (GMT) From: Sourabh Jain To: bhe@redhat.com Cc: Hari Bathini , Michael Ellerman , kexec@lists.infradead.org, linuxppc-dev@ozlabs.org, linux-kernel@vger.kernel.org, x86@kernel.org, Sachin P Bappalige Subject: [PATCH v2] kexec/crash: no crash update when kexec in progress Date: Wed, 11 Sep 2024 16:45:28 +0530 Message-ID: <20240911111528.104303-1-sourabhjain@linux.ibm.com> X-Mailer: git-send-email 2.46.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: LXb6hJqXbhDVpIsaY4eYybKBdraT82cB X-Proofpoint-ORIG-GUID: jLbe-4MlMbIJfO3TCUFPXY5Xfgyq3fnl Content-Transfer-Encoding: quoted-printable X-Proofpoint-UnRewURL: 0 URL was un-rewritten Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-10_12,2024-09-09_02,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 malwarescore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=999 priorityscore=1501 adultscore=0 clxscore=1011 spamscore=0 bulkscore=0 phishscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2408220000 definitions=main-2409110082 Content-Type: text/plain; charset="utf-8" The following errors are observed when kexec is done with SMT=3Doff on powerpc. [ 358.458385] Removing IBM Power 842 compression device [ 374.795734] kexec_core: Starting new kernel [ 374.795748] kexec: Waking offline cpu 1. [ 374.875695] crash hp: kexec_trylock() failed, elfcorehdr may be inaccura= te [ 374.935833] kexec: Waking offline cpu 2. [ 375.015664] crash hp: kexec_trylock() failed, elfcorehdr may be inaccura= te snip.. [ 375.515823] kexec: Waking offline cpu 6. [ 375.635667] crash hp: kexec_trylock() failed, elfcorehdr may be inaccura= te [ 375.695836] kexec: Waking offline cpu 7. To avoid kexec kernel boot failure on PowerPC, all the present CPUs that are offline are brought online during kexec. For more information, refer to commit e8e5c2155b00 ("powerpc/kexec: Fix orphaned offline CPUs across kexec"). Bringing the CPUs online triggers the crash hotplug handler, crash_handle_hotplug_event(), to update the kdump image. Since the system is on the kexec kernel boot path and the kexec lock is held, the crash_handle_hotplug_event() function fails to acquire the same lock to update the kdump image, resulting in the error messages mentioned above. To fix this, return from crash_handle_hotplug_event() without printing the error message if kexec is in progress. The same applies to the crash_check_hotplug_support() function. Return 0 if kexec is in progress because kernel is not in a position to update the kdump image. Cc: Hari Bathini Cc: Michael Ellerman Cc: kexec@lists.infradead.org Cc: linuxppc-dev@ozlabs.org Cc: linux-kernel@vger.kernel.org Cc: x86@kernel.org Reported-by: Sachin P Bappalige Signed-off-by: Sourabh Jain --- Changelog: Since v1: - Keep the kexec_in_progress check within kexec_trylock() - Baoquan He - Include the reason why PowerPC brings offline CPUs online during the kexec kernel boot path - Baoquan He - Rebased on top of #next-20240910 to avoid conflict with the patch below https://lore.kernel.org/all/20240812041651.703156-1-sourabhjain@linux.ib= m.com/T/#u --- kernel/crash_core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kernel/crash_core.c b/kernel/crash_core.c index c1048893f4b6..078fe5bc5a74 100644 --- a/kernel/crash_core.c +++ b/kernel/crash_core.c @@ -505,7 +505,8 @@ int crash_check_hotplug_support(void) crash_hotplug_lock(); /* Obtain lock while reading crash information */ if (!kexec_trylock()) { - pr_info("kexec_trylock() failed, kdump image may be inaccurate\n"); + if (!kexec_in_progress) + pr_info("kexec_trylock() failed, kdump image may be inaccurate\n"); crash_hotplug_unlock(); return 0; } @@ -547,7 +548,8 @@ static void crash_handle_hotplug_event(unsigned int hp_= action, unsigned int cpu, crash_hotplug_lock(); /* Obtain lock while changing crash information */ if (!kexec_trylock()) { - pr_info("kexec_trylock() failed, kdump image may be inaccurate\n"); + if (!kexec_in_progress) + pr_info("kexec_trylock() failed, kdump image may be inaccurate\n"); crash_hotplug_unlock(); return; } --=20 2.46.0