Received: by 2002:a05:7412:bb8d:b0:d7:7d3a:4fe2 with SMTP id js13csp1532775rdb; Wed, 16 Aug 2023 14:35:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHLxxT8NofNABNWF4aC8QTtQMeFtFex9Z84ZscA1huuhJwhcYhGyEVxxWG06lAZSG8VTG68 X-Received: by 2002:a05:6a20:a11d:b0:10c:7c72:bdf9 with SMTP id q29-20020a056a20a11d00b0010c7c72bdf9mr3801684pzk.29.1692221709001; Wed, 16 Aug 2023 14:35:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692221708; cv=none; d=google.com; s=arc-20160816; b=yL+d5WQvXC2IEi/ewNmsQM1T4QnLHPwHDn186fGg15RzSK+qDar6szQVwtqzh1gu1t G2DaLILe7uUUVJ51YHfg/4pIceQ85peA2XkSysYTFUBDJ3BO9hie78OAiAe+mgPgIImw IatvioZetrBxmit+MLFERZz7/WRNNE9oy6SJBt8Uk1bAn7hf4L9oGEFzo7U8lBhBCIVn QTC42ybHl5RtvDobR90CB9qlb+G5ZFlsqs6hjHJinSOeEwyBHE4esx0JAOBf0BTVpWwf b5rt57/rzo3HaetPq7PotDvAxxvzivAriEW8x7e0KFnfQlOMTIPMjQeRKH28y5jJYkKX rJvQ== 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 :message-id:date:references:in-reply-to:subject:to:from :dkim-signature; bh=0x89vx8T7ctChfZuk4nUajsbvgaqWMb4v5FnF8RzIps=; fh=Zzsx3C6MdSAD4HO32/wtJZf5KI9S3NhAcVZI9qiwWD8=; b=f7mk2mFfA4RbHHym7hxlEY1eJGqd8+40sxGBnmxhc1JaLgi/KPdJ5981UI51162UMJ zVpXtkLWY1AF8gHpo9VwiqJKQ5YAYk03xCDBzdY/xV2ZNXixoQUE9BetRO21WrxMvAls PGsGqfSjQE/zQaFWBEUWZTRvCP/LBwdUVARAf27Gxq8W7m+T+CEQqmh+rD+D+qZ0cnCo sJlZZ+AJQepKQm/gKI/NS47/f6aRDcVV1gA7AKEmqbNNBoyk9kVrcD+PVwTdcyfpy6dF AjTPCaIHDsu6M+ZyX/irkz3PgaMByOJczn6D3Jc4HfsgLGjOGc4m22jL+aseYDhcKTPc 4kXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=d2ilGcmU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r5-20020a654985000000b005641315d956si12339215pgs.147.2023.08.16.14.34.56; Wed, 16 Aug 2023 14:35:08 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=d2ilGcmU; 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344029AbjHPPLZ (ORCPT + 99 others); Wed, 16 Aug 2023 11:11:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344025AbjHPPKz (ORCPT ); Wed, 16 Aug 2023 11:10:55 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0875B1FCE for ; Wed, 16 Aug 2023 08:10:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9B49863AB4 for ; Wed, 16 Aug 2023 15:10:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8D7BEC433BC; Wed, 16 Aug 2023 15:10:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692198654; bh=0x89vx8T7ctChfZuk4nUajsbvgaqWMb4v5FnF8RzIps=; h=From:To:Subject:In-Reply-To:References:Date:From; b=d2ilGcmUc2lIoXlJIxwbA9xsJE8ThubtKAfd5IO0NRTSTadGqUE8bCddtcFkE2AbS YiUjYK9SeLUS95ZDV49L5iI/kuFcZFS1nydpgRoIR3FB+TMv7PDkUakxLkecYndN/W WsB6X0Kc7+N/iH7zGCSZuHfNlA9PZv0t2S/7TcYm7l6CJMSCkKk0LJ8h6YOzGsws6T /Ek8MmIsJcdtaj3NuAvIvUwgmva44HAZbG1kDsBLeeLn4E8w2diMJyJmBBMbNZE7FZ ITi1FtPkH6JNTxdVqvyiNJC6aEcrqX1VlUUvUIX+FuxC6x7fQnvYSQ7hZuPlGv47bb DX2l/+G/IS98A== From: =?utf-8?B?QmrDtnJuIFTDtnBlbA==?= To: Yunhui Cui , conor.dooley@microchip.com, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, peterz@infradead.org, mpe@ellerman.id.au, jpoimboe@kernel.org, mark.rutland@arm.com, svens@linux.ibm.com, cuiyunhui@bytedance.com, guoren@kernel.org, jszhang@kernel.org, ebiederm@xmission.com, bjorn@rivosinc.com, heiko@sntech.de, xianting.tian@linux.alibaba.com, mnissler@rivosinc.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] riscv: Dump user opcode bytes on fatal faults In-Reply-To: <20230329082950.726-1-cuiyunhui@bytedance.com> References: <20230329082950.726-1-cuiyunhui@bytedance.com> Date: Wed, 16 Aug 2023 17:10:51 +0200 Message-ID: <87v8dfqays.fsf@all.your.base.are.belong.to.us> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Hi Yunhui, Waking up the dead! ;-) Yunhui Cui writes: > We encountered such a problem that when the system starts to execute > init, init exits unexpectedly with error message: "unhandled signal 4 > code 0x1 ...". > > We are more curious about which instruction execution caused the > exception. After dumping it through show_opcodes(), we found that it > was caused by a floating-point instruction. > > In this way, we found the problem: in the system bringup , it is > precisely that we have not enabled the floating point function(CONFIG_FPU > is set, but not enalbe COMPAT_HWCAP_ISA_F/D in the dts or acpi). > > Like commit ba54d856a9d8 ("x86/fault: Dump user opcode bytes on fatal > faults"), when an exception occurs, it is necessary to dump the > instruction that caused the exception. X86's show_opcodes() is used both for kernel oops:es, and userland unhandled signals. On RISC-V there's dump_kernel_instr() added in commit eb165bfa8eaf ("riscv: Add instruction dump to RISC-V splats"). Wdyt about reworking that function, so that it works for userland epc as well? I think it's useful to have the surrounding instruction context, and not just on instruction. Bj=C3=B6rn