From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6EC47CA0EFA for ; Thu, 21 Aug 2025 03:39:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=b8qT54c0ZICxodssvZk0IEbO+CpWQT3Dngc++Z4hkSY=; b=Zk+oZjW9IBTn7rfdqCdKgCiC1c P1A9B1IWjD9cYuYyu7cCTeBg6r3Yeno5yIa9SwHhBM1DHmVeVe5i4az5c63mUMAppyDmFQViaCFs5 cKINsg/uec0xpbwjkbyf4OY9RjSEjRzpIB2FGseHxzd1xxbKSYeuS7gPoUdFDkNplw3MIk+LwNt4p kINCAihgHRZXZBx+UOYL/8PlOgdQij8xUjGY0PWvJ5MQneFb0hkPvonosNa4gJPlDp+ac0MgC5r/t pSaNJdM714yWcp/W7Dvh8iERUgy9OD14r9XRx+X9WqWP9GUOCEKd1N8RHZbTEAd85Ooz3CmSoACGr g7DPQZ0g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1uow8c-0000000FfLd-1JwU; Thu, 21 Aug 2025 03:38:54 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1uovH0-0000000FZAk-1gCh for kexec@lists.infradead.org; Thu, 21 Aug 2025 02:43:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1755744209; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=b8qT54c0ZICxodssvZk0IEbO+CpWQT3Dngc++Z4hkSY=; b=jF+k3mcXyY4jGZ4A3tqJSmLDULAmKUgbOYD241/cAt+nVqI5TfA4cn85zi6mEv2iVrDxg3 fmWy+YjlfzMZlsyiOVJ+kiG8Fdcrp6xyZr3tzfdQVRh78GczvaOFcEfCMj3zN40gLEq+E6 BK5AWVGjNR7tS8NOprQhPC4UP2SV9Og= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-169-KsQQNM9wOAel1kmqlx-owA-1; Wed, 20 Aug 2025 22:43:21 -0400 X-MC-Unique: KsQQNM9wOAel1kmqlx-owA-1 X-Mimecast-MFC-AGG-ID: KsQQNM9wOAel1kmqlx-owA_1755744200 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id DAE9B1800366; Thu, 21 Aug 2025 02:43:19 +0000 (UTC) Received: from localhost (unknown [10.72.112.99]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 9024A19560B0; Thu, 21 Aug 2025 02:43:16 +0000 (UTC) Date: Thu, 21 Aug 2025 10:43:10 +0800 From: Baoquan He To: Jinchao Wang Cc: pmladek@suse.com, akpm@linux-foundation.org, Vivek Goyal , Dave Young , linux-kernel@vger.kernel.org, feng.tang@linux.alibaba.com, joel.granados@kernel.org, john.ogness@linutronix.de, namcao@linutronix.de, sravankumarlpu@gmail.com, kexec@lists.infradead.org Subject: Re: [PATCH 3/9] crash_core: use panic_try_start() in crash_kexec() Message-ID: References: <20250820091702.512524-1-wangjinchao600@gmail.com> <20250820091702.512524-2-wangjinchao600@gmail.com> <20250820091702.512524-3-wangjinchao600@gmail.com> <20250820091702.512524-4-wangjinchao600@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250820091702.512524-4-wangjinchao600@gmail.com> X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250820_194330_510160_C3779675 X-CRM114-Status: GOOD ( 24.36 ) X-BeenThere: kexec@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kexec" Errors-To: kexec-bounces+kexec=archiver.kernel.org@lists.infradead.org On 08/20/25 at 05:14pm, Jinchao Wang wrote: > crash_kexec() had its own code to exclude > parallel execution by setting panic_cpu. > This is already handled by panic_try_start(). > > Switch to panic_try_start() to remove the > duplication and keep the logic consistent. > > Signed-off-by: Jinchao Wang I had to use b4 to grab back the whole patchset, but I can't comment on other patches, especially the patch 1. Firstly, this series looks interesting. It does enhance code readibility. But I am a vim user, I like open code on this one line of code wrapping. So leave this to other reviewers to decide if this should be accepted. Secondly, the lines of your patch log are too short, it's not convenient for reading. Can you set your mail writer to change this. Thirdly, please add people to CC in all patches. I don't know why you only CC me in patch 3 if the whole patchset is related to crash and panic. Thanks Baoquan > --- > kernel/crash_core.c | 15 +++------------ > 1 file changed, 3 insertions(+), 12 deletions(-) > > diff --git a/kernel/crash_core.c b/kernel/crash_core.c > index a4ef79591eb2..bb38bbaf3a26 100644 > --- a/kernel/crash_core.c > +++ b/kernel/crash_core.c > @@ -4,6 +4,7 @@ > * Copyright (C) 2002-2004 Eric Biederman > */ > > +#include "linux/panic.h" > #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt > > #include > @@ -143,17 +144,7 @@ STACK_FRAME_NON_STANDARD(__crash_kexec); > > __bpf_kfunc void crash_kexec(struct pt_regs *regs) > { > - int old_cpu, this_cpu; > - > - /* > - * Only one CPU is allowed to execute the crash_kexec() code as with > - * panic(). Otherwise parallel calls of panic() and crash_kexec() > - * may stop each other. To exclude them, we use panic_cpu here too. > - */ > - old_cpu = PANIC_CPU_INVALID; > - this_cpu = raw_smp_processor_id(); > - > - if (atomic_try_cmpxchg(&panic_cpu, &old_cpu, this_cpu)) { > + if (panic_try_start()) { > /* This is the 1st CPU which comes here, so go ahead. */ > __crash_kexec(regs); > > @@ -161,7 +152,7 @@ __bpf_kfunc void crash_kexec(struct pt_regs *regs) > * Reset panic_cpu to allow another panic()/crash_kexec() > * call. > */ > - atomic_set(&panic_cpu, PANIC_CPU_INVALID); > + panic_reset(); > } > } > > -- > 2.43.0 >