Received: by 2002:ac0:da4c:0:0:0:0:0 with SMTP id a12csp395913imi; Fri, 22 Jul 2022 01:11:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tzmgYC5hUVZrzYpxNbPh1IDTUqTh4hXH4Hc4fyrfP/YlIqmpqANhnG5PDtM/erXVu8extg X-Received: by 2002:a65:6d9a:0:b0:412:b140:4dc1 with SMTP id bc26-20020a656d9a000000b00412b1404dc1mr2252858pgb.272.1658477470704; Fri, 22 Jul 2022 01:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658477470; cv=none; d=google.com; s=arc-20160816; b=0/aK5qkK+AlVjYY2ZIyJ3aRBYQ0HwU8yabrLrx0MjFLiVPtxpVLCbiz3cTGJvcy1a2 VyEiF3LfdHgCoz9RfhRufBwGGb4eohVy8nL9WOLSfQHUcO3Zac7vL9DkaO9OTu26sN2O /TeG1G5jVxNz41oNrXbmRclbXEtMZDBxgvBByfoRL4IzcJAQPDw+01hZzhwoMiX8uMhG qLCtekctc4ism9oIyFUoEhboXSgOhIWHN50vptq+EHimkap38Jw0XuRd8pURy0eV5RTU MWTwwpSLtkGUJ5trt3BlE1/mzUupWP81nM1UXJWPgF5QKq+gwONErxKKye7cnBRrL239 OZIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=jMv6TytbdO3YL7rUvIsbgR/PP9imZNHesoX0K/bt2KA=; b=T6QWOfuQtcflczckCUWVpasICsc5HMirtsLc3i61xmss92WpTMCU4PwbCgBCkAjCtQ BXkqSbzhv6fcGdhbfaJ/zAYubTSJgmRjANbOobmwF8GJHiU3nYJbsOiruw9owumcVSJe YSmkf5gtgoYkSQd2WByZRw9QNJ19Wox0pV6sM6fb9env0EPluk9diOurfdt3/b64fEwH rjrHpbqX2H0WpBKnImHzWpoufwSzWFpm/XCVRdhifQea1lK2/wMBfimPS27Ncmt19w5C cZhPPZODj/kkzTcePd2Ig+xOXgCu0mwqMbcSBJnmgkJWCEJf6i+yFuU4bvxANKgyNou+ 63KQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s21-20020a056a00179500b0050d8195100bsi6093130pfg.7.2022.07.22.01.10.54; Fri, 22 Jul 2022 01:11:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234644AbiGVHSY (ORCPT + 99 others); Fri, 22 Jul 2022 03:18:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42466 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234642AbiGVHSG (ORCPT ); Fri, 22 Jul 2022 03:18:06 -0400 Received: from gloria.sntech.de (gloria.sntech.de [185.11.138.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDCCE20F78 for ; Fri, 22 Jul 2022 00:18:01 -0700 (PDT) Received: from ip5b412258.dynamic.kabel-deutschland.de ([91.65.34.88] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1oEmuu-0005DJ-1O; Fri, 22 Jul 2022 09:17:44 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, anup@brainfault.org, guoren@kernel.org, mick@ics.forth.gr, alexandre.ghiti@canonical.com, Xianting Tian Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, crash-utility@redhat.com, huanyi.xj@alibaba-inc.com, heinrich.schuchardt@canonical.com, k-hagio-ab@nec.com, hschauhan@nulltrace.org, Xianting Tian Subject: Re: [PATCH 2/5] RISC-V: use __smp_processor_id() instead of smp_processor_id() Date: Fri, 22 Jul 2022 09:17:43 +0200 Message-ID: <2189907.iZASKD2KPV@diego> In-Reply-To: <20220717101323.370245-3-xianting.tian@linux.alibaba.com> References: <20220717101323.370245-1-xianting.tian@linux.alibaba.com> <20220717101323.370245-3-xianting.tian@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_PASS, T_SPF_HELO_TEMPERROR autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Sonntag, 17. Juli 2022, 12:13:20 CEST schrieb Xianting Tian: > Use __smp_processor_id() to avoid check the preemption context when > CONFIG_DEBUG_PREEMPT enabled, as we will enter crash kernel and no > return. > > Without the patch, > [ 103.781044] sysrq: Trigger a crash > [ 103.784625] Kernel panic - not syncing: sysrq triggered crash > [ 103.837634] CPU1: off > [ 103.889668] CPU2: off > [ 103.933479] CPU3: off > [ 103.939424] Starting crashdump kernel... > [ 103.943442] BUG: using smp_processor_id() in preemptible [00000000] code: sh/346 > [ 103.950884] caller is debug_smp_processor_id+0x1c/0x26 > [ 103.956051] CPU: 0 PID: 346 Comm: sh Kdump: loaded Not tainted 5.10.113-00002-gce03f03bf4ec-dirty #149 > [ 103.965355] Call Trace: > [ 103.967805] [] walk_stackframe+0x0/0xa2 > [ 103.973206] [] show_stack+0x32/0x3e > [ 103.978258] [] dump_stack_lvl+0x72/0x8e > [ 103.983655] [] dump_stack+0x14/0x1c > [ 103.988705] [] check_preemption_disabled+0x9e/0xaa > [ 103.995057] [] debug_smp_processor_id+0x1c/0x26 > [ 104.001150] [] machine_kexec+0x22/0xd0 > [ 104.006463] [] __crash_kexec+0x6a/0xa4 > [ 104.011774] [] panic+0xfc/0x2b0 > [ 104.016480] [] sysrq_reset_seq_param_set+0x0/0x70 > [ 104.022745] [] __handle_sysrq+0x8c/0x154 > [ 104.028229] [] write_sysrq_trigger+0x5a/0x6a > [ 104.034061] [] proc_reg_write+0x58/0xd4 > [ 104.039459] [] vfs_write+0x7e/0x254 > [ 104.044509] [] ksys_write+0x58/0xbe > [ 104.049558] [] sys_write+0xe/0x16 > [ 104.054434] [] ret_from_syscall+0x0/0x2 > [ 104.067863] Will call new kernel at ecc00000 from hart id 0 > [ 104.074939] FDT image at fc5ee000 > [ 104.079523] Bye... > > With the patch we can got clear output, > [ 67.740553] sysrq: Trigger a crash > [ 67.744166] Kernel panic - not syncing: sysrq triggered crash > [ 67.809123] CPU1: off > [ 67.865210] CPU2: off > [ 67.909075] CPU3: off > [ 67.919123] Starting crashdump kernel... > [ 67.924900] Will call new kernel at ecc00000 from hart id 0 > [ 67.932045] FDT image at fc5ee000 > [ 67.935560] Bye... > > Fixes: 0e105f1d0037 ("riscv: use hart id instead of cpu id on machine_kexec") > Reviewed-by: Guo Ren > Signed-off-by: Xianting Tian Reviewed-by: Heiko Stuebner