Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp4141594rwp; Sat, 15 Jul 2023 18:09:55 -0700 (PDT) X-Google-Smtp-Source: APBJJlEGLpm/y2D1Z6GS2nf7p8waQk0HWGOPv2C53V0t6D/vbhDHezEY0jj9UoTsqObtX20bCkFL X-Received: by 2002:a17:906:74c1:b0:98d:eaa8:8c27 with SMTP id z1-20020a17090674c100b0098deaa88c27mr2918900ejl.1.1689469795619; Sat, 15 Jul 2023 18:09:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689469795; cv=none; d=google.com; s=arc-20160816; b=PF11s3WQhb4BepUxilxBS5KTCNmKwg6tj49i0haIQadhwwKupILJRAagUkLm2yePb0 G1WNnjM2SoJEadX5xoRqC/ngYtiYyPcirV0aJMeWrDq8EpYcRQiJuX6Hax7oxEg0HzvM HNX2gNPOmvRCi3FefUPr1ex/RQYJBtoIVDg5hBH1opk161bcMhewfXNncpuGZtFyxIRZ Hk+iBXAPOrYUUaZKuW4uHu9GSJ4qz72OiP3FZVjgh3TsRlhLYbZ2oKIAABlGWYkYrasN goihRmPOjUjTxzf0S/874hQDiHhtPLpKXIiCY+8QSv52/P+3HEPN4awbjD9FBK2tDLjz PCZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=mWbTXpepwEBGjQ7R3eoyTBF1FTuL6DWQ7f6TDzrZBpI=; fh=Qcj126fy+oR9+TUQInc7zhNeRNmm55VHlWa5xl/c658=; b=XuJxCplkhyib9bUKMEznyO6vAQvKE9ZL2wzDUsxRtP++Q4pSITalD/nfwuwLRYOiUP VXCQ3Eq0PQn2326oeC3R4HcpGgn6hQQv69B9/wYbERHb47or8NzprVUcfzF6AvlbJobG fMkaoUuYCDwOsfbF12thJyDfAV5o2LoeJMz0TCk/nQmvAT+efYj9X/zjRDgCflYo6ek2 dGqU2k8oYt+urTY+RoiFN9LtXEBoHDHDZR+rHbPSt6Dj6k4LRFC6vhVdy1ZxYRTQQNNk DB4AHcl3AQC9bio7xMLNFt8n5lyYFJY3xv/HQJi/2SWikXn4uoiWnbSfzQpl9Hc+9eWC hhrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nKRdrLu8; 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 n22-20020a170906841600b00992bd86ece6si4780131ejx.725.2023.07.15.18.09.22; Sat, 15 Jul 2023 18:09:55 -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=nKRdrLu8; 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 S229875AbjGPASg (ORCPT + 99 others); Sat, 15 Jul 2023 20:18:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40406 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229631AbjGPASf (ORCPT ); Sat, 15 Jul 2023 20:18:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E645812D; Sat, 15 Jul 2023 17:18:34 -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 6850760C4E; Sun, 16 Jul 2023 00:18:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5BEAC433C8; Sun, 16 Jul 2023 00:18:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689466713; bh=418o5psNdMRdFlKcUS6XKpTnTtdjq3bya0znIgig6+A=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=nKRdrLu8bv5eYAJ2c5iKAM16xzr7Ue5vgO7pVwpFxT7Vms+/WnOwFUaEhqsj6db3M TRmxINruQbTjtN7VeyujDj3dNERtdMd1JMAFFvwdBSlgiB0o0nUg8gpe6iIgom9Vr5 KqG/zIZyo0nXgQGNcB49jSvS5Zy1CsYvl2030kGlWnC3n/7BZ4+a4FQyr8vqv2ybMV naL5FxDCer9WSF9PkfqHrIU4OxW+voC5TW8S8zwkz2FjdsVHKfnf4FRxx3DmLMdldg gKXnakElPq1PJb83oeaTpXvy/kfpFlyUzkC9hHiLV0bjnmVcBp1QIFR0qd0hjyjqAd lOBzCTqElYc4g== Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-52165886aa3so2551713a12.3; Sat, 15 Jul 2023 17:18:33 -0700 (PDT) X-Gm-Message-State: ABy/qLb22KoG7Q0bTNCAgDiWpd5Gd3zbs7RdV7YyCmaUidygO5vDYrBu ODX/00bZUhjc7cIrNU4jhTUX5FsgZIe95k1FEYI= X-Received: by 2002:aa7:d684:0:b0:51d:e7b5:547d with SMTP id d4-20020aa7d684000000b0051de7b5547dmr8017511edr.34.1689466712015; Sat, 15 Jul 2023 17:18:32 -0700 (PDT) MIME-Version: 1.0 References: <20230715134552.3437933-1-guoren@kernel.org> In-Reply-To: <20230715134552.3437933-1-guoren@kernel.org> From: Guo Ren Date: Sun, 16 Jul 2023 08:18:20 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 0/2] riscv: stack: Fixup independent softirq/irq stack for CONFIG_FRAME_POINTER=n To: guoren@kernel.org, palmer@rivosinc.com, paul.walmsley@sifive.com, falcon@tinylab.org, bjorn@kernel.org, conor.dooley@microchip.com Cc: linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, stable@vger.kernel.org, Guo Ren Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 I'm sorry, this patch would break CONFIG_FRAME_POINTER=3Dy, so please aband= on it. I've updated a v2 with the stable@ver.kernel.org tag fixed: https://lore.kernel.org/linux-riscv/20230716001506.3506041-1-guoren@kernel.= org/ On Sat, Jul 15, 2023 at 9:46=E2=80=AFPM wrote: > > From: Guo Ren > > The independent softirq/irq stack uses s0 to save & restore sp, but s0 > would be corrupted when CONFIG_FRAME_POINTER=3Dn. So add s0 in the clobbe= r > list to fix the problem. > > <+0>: addi sp,sp,-32 > <+2>: sd s0,16(sp) > <+4>: sd s1,8(sp) > <+6>: sd ra,24(sp) > <+8>: sd s2,0(sp) > <+10>: mv s0,a0 --> compiler allocate s0 for a0 when CONF= IG_FRAME_POINTER=3Dn > <+12>: jal ra,0xffffffff800bc0ce > <+16>: ld a5,56(tp) # 0x38 > <+20>: lui a4,0x4 > <+22>: mv s1,a0 > <+24>: xor a5,a5,sp > <+28>: bgeu a5,a4,0xffffffff800bc092 > <+32>: auipc s2,0x5d > <+36>: ld s2,1118(s2) # 0xffffffff801194b8 > <+40>: add s2,s2,a4 > <+42>: addi sp,sp,-8 > <+44>: sd ra,0(sp) > <+46>: addi sp,sp,-8 > <+48>: sd s0,0(sp) > <+50>: addi s0,sp,16 --> our code clobber the s0 > <+52>: mv sp,s2 > <+54>: mv a0,s0 --> a0 got wrong value for handle_riscv_i= rq > <+56>: jal ra,0xffffffff800bbb3a > > Guo Ren (2): > riscv: stack: Fixup independent irq stack for CONFIG_FRAME_POINTER=3Dn > riscv: stack: Fixup independent softirq stack for > CONFIG_FRAME_POINTER=3Dn > > arch/riscv/kernel/irq.c | 2 +- > arch/riscv/kernel/traps.c | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > -- > 2.36.1 > -- Best Regards Guo Ren