Message ID | 20230222093730.1826523-1-suagrfillet@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp480117wrd; Wed, 22 Feb 2023 01:50:56 -0800 (PST) X-Google-Smtp-Source: AK7set8/VCuH5kqLgPnxMgLMR73YC/pVUGyGLPm45APe6dxe8smKhiC4atSfcawBVqM9lP6YBqiw X-Received: by 2002:a17:902:f90d:b0:19a:858e:ab9c with SMTP id kw13-20020a170902f90d00b0019a858eab9cmr6507441plb.36.1677059456616; Wed, 22 Feb 2023 01:50:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677059456; cv=none; d=google.com; s=arc-20160816; b=F/ZFb5YRywI0QBdVPPlMO31Fg4FA3VOU86JCDocAm6IJ24iI5QK3ZWBZDtndI1IIyu 25M4qwnYC1oIG6Ca4W8WJbgpaI4P68/UpwKVxq6S04RiF5fhb5nYkoWmm8ndCCo8Q9/1 Vwhrx4hOAdPecHpjNN3Z/oreo/2m/WIDFnVvghzCfCjtPAEht+jZTp4ROHo7kegpY37O gZTZq4UM3soqS6XMiC0bR4O5rRV4/9AKINklKKbmKzD0MzDbPJqyLaeI52fh38ap5b1P MMOUf3qupu8uQjNaPrcGgTrwALJQi5nOlEExBxuc0K27TkIcf2S0/1mgQO2U27SIiNU9 N8yw== 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:subject:cc:to:from:dkim-signature; bh=wTFoYDHyDNw2PubV9IEzg7rOSljDE2ce7yhJPe+zOrE=; b=I1MUGLR1blxUUqXe/HPeID07Ogi6lIxpFI0nsc4sz7XQnbs41yL/YrpAtVcaScUINw lUIG7V93PdVGnqhRSMQ14+GDtuFNTnR38zhf1RbeL350xN6uru1Mqy0oiEmEuXpi75Dn sLtke/VZEDBjv0RTq+i71KE+iRuXFRG9cAVEqWItQ2G57O18W3pxeBZDJqvHj0RFI6HB 6UA0q7wzYK+4pild58IittPuozwiFEhBUhQ8RtL26hlrhJfejZPiWGJXMtG3+mNu41+f AAU65MqCVQJmNb4VMgzb6iXL97jBpHOzuxpMT98ebbifvrRJMllbxzb7swFmsL6vvTXe zzFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=i+tTMlzh; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o11-20020a170902d4cb00b0019953ab9cf2si7143497plg.138.2023.02.22.01.50.44; Wed, 22 Feb 2023 01:50:56 -0800 (PST) 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=@gmail.com header.s=20210112 header.b=i+tTMlzh; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232248AbjBVJl7 (ORCPT <rfc822;dengxinlin2429@gmail.com> + 99 others); Wed, 22 Feb 2023 04:41:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232221AbjBVJlj (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 22 Feb 2023 04:41:39 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54C7438B61 for <linux-kernel@vger.kernel.org>; Wed, 22 Feb 2023 01:38:41 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id d1-20020a17090a3b0100b00229ca6a4636so8257472pjc.0 for <linux-kernel@vger.kernel.org>; Wed, 22 Feb 2023 01:38:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=wTFoYDHyDNw2PubV9IEzg7rOSljDE2ce7yhJPe+zOrE=; b=i+tTMlzh1EU79Pqqv2bPjoY1DWvpU3lBwHjaX+1HgszI7jIpoZnz+as19+HqI6Ssd/ 00MJ9FL2+u3dNkbe2baGzgMfTvpVqSKf/zYSdJzf8j/8voNpzJhM7GJEOevub/dqPxCS OS2cr1b51EMu5vf48JwuobZ9+99kl/DpgvTWytEuYDBvLjItW88YgtroWDAsNmYeBRPf j4ON1KBdAP1eN+J5I4ha5Szl8yoSVNufa5DLIQHLsdNb4Q3BMZK216AZJ3WLk/sF47zl xeKPyHL8zOYjmRFLif58eIh/ctkmIMkFP7W/SOq+WexKkBlxeXrk1p4Nwcp/jKuzv1Gu WSSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=wTFoYDHyDNw2PubV9IEzg7rOSljDE2ce7yhJPe+zOrE=; b=Dnxmlk6MvV4lkLeg0zd3thquBBR+DKiMqLphz+TiJvo0A0BpRxl+4d3JOwQ8F1fmzV hZtfDpAh7wia1Hve86M6aaP/H665Xnk2ycLojqp8NYD9saZqX8aWYHwzSTyPtb7eSDex m+bH/qJp90m69X1zyt7hDYmEwdkI/ZAYSbR4DA/iluF9B9iK21nnhEQEanHgypDxEggX K4jE4VnoFWX1nDL+2HxH3MykjX8wCcPoWpR8+BBX2x/t9d/F0RH54L7VUfLAer4L+jbA BxuEz5y6YEl+gw6nE+ovadPvErZR1nsLST0Dmi3qiLGBjHSvnTv7UJrsoJax8hGdeD20 wTGA== X-Gm-Message-State: AO0yUKXGNe8dI7rXSZXF8L8ACqwyGsAuKNc+vDsF09wsF+fxodCyB/FA azQyHlN82ppvXtR6CrT2Fhc= X-Received: by 2002:a17:902:e883:b0:19a:a810:542 with SMTP id w3-20020a170902e88300b0019aa8100542mr8932659plg.61.1677058657889; Wed, 22 Feb 2023 01:37:37 -0800 (PST) Received: from localhost.localdomain ([221.226.144.218]) by smtp.gmail.com with ESMTPSA id h6-20020a170902eec600b0017a032d7ae4sm2392324plb.104.2023.02.22.01.37.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 01:37:37 -0800 (PST) From: Song Shuai <suagrfillet@gmail.com> To: jan.kiszka@siemens.com, kbingham@kernel.org, paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu Cc: linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, Song Shuai <suagrfillet@gmail.com> Subject: [PATCH RESEND] scripts/gdb: add lx_current support for riscv Date: Wed, 22 Feb 2023 17:37:30 +0800 Message-Id: <20230222093730.1826523-1-suagrfillet@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758524079293415358?= X-GMAIL-MSGID: =?utf-8?q?1758524297144255862?= |
Series |
[RESEND] scripts/gdb: add lx_current support for riscv
|
|
Commit Message
Song Shuai
Feb. 22, 2023, 9:37 a.m. UTC
RISC-V uses the tp register to save the current task_struct address
as its current() defines. So lx_current() of riscv just returns the
dereference of the address cast via task_ptr_type.
Signed-off-by: Song Shuai <suagrfillet@gmail.com>
---
scripts/gdb/linux/cpus.py | 3 +++
1 file changed, 3 insertions(+)
Comments
Hey Song On Wed, Feb 22, 2023 at 05:37:30PM +0800, Song Shuai wrote: > RISC-V uses the tp register to save the current task_struct address > as its current() defines. So lx_current() of riscv just returns the > dereference of the address cast via task_ptr_type. FYI, there's already been some patches posted for this: https://lore.kernel.org/all/mhng-bdcd75a5-e6d6-4090-8292-a32eb46e4464@palmer-ri-x1c9a/ That version already has review and ack tags from Palmer and others. It seems to me that Andrew is the usual applier of patches for this script, so I'm gonna add him to CC here so he is aware - but as it is the middle of the merge window the best course of action might just be reposting that patch, CCing Andrew, after v6.3-rc1. Cheers, Conor. > > Signed-off-by: Song Shuai <suagrfillet@gmail.com> > --- > scripts/gdb/linux/cpus.py | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/scripts/gdb/linux/cpus.py b/scripts/gdb/linux/cpus.py > index 15fc4626d236..6825a9834394 100644 > --- a/scripts/gdb/linux/cpus.py > +++ b/scripts/gdb/linux/cpus.py > @@ -173,6 +173,9 @@ def get_current_task(cpu): > else: > raise gdb.GdbError("Sorry, obtaining the current task is not allowed " > "while running in userspace(EL0)") > + elif utils.is_target_arch("riscv"): > + current_task_addr = gdb.parse_and_eval("$tp") > + return current_task_addr.cast(task_ptr_type).dereference() > else: > raise gdb.GdbError("Sorry, obtaining the current task is not yet " > "supported with this arch") > -- > 2.20.1 > >
Conor Dooley <conor.dooley@microchip.com> 于2023年2月22日周三 09:53写道: > > Hey Song > > On Wed, Feb 22, 2023 at 05:37:30PM +0800, Song Shuai wrote: > > RISC-V uses the tp register to save the current task_struct address > > as its current() defines. So lx_current() of riscv just returns the > > dereference of the address cast via task_ptr_type. > > FYI, there's already been some patches posted for this: > https://lore.kernel.org/all/mhng-bdcd75a5-e6d6-4090-8292-a32eb46e4464@palmer-ri-x1c9a/ > Deepak's patch is much better than mine, which also takes the userspace and trap handler into count. So no need to care about this patch. > That version already has review and ack tags from Palmer and others. > It seems to me that Andrew is the usual applier of patches for this > script, so I'm gonna add him to CC here so he is aware - but as it is > the middle of the merge window the best course of action might just be > reposting that patch, CCing Andrew, after v6.3-rc1. > > Cheers, > Conor. > > > > > Signed-off-by: Song Shuai <suagrfillet@gmail.com> > > --- > > scripts/gdb/linux/cpus.py | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/scripts/gdb/linux/cpus.py b/scripts/gdb/linux/cpus.py > > index 15fc4626d236..6825a9834394 100644 > > --- a/scripts/gdb/linux/cpus.py > > +++ b/scripts/gdb/linux/cpus.py > > @@ -173,6 +173,9 @@ def get_current_task(cpu): > > else: > > raise gdb.GdbError("Sorry, obtaining the current task is not allowed " > > "while running in userspace(EL0)") > > + elif utils.is_target_arch("riscv"): > > + current_task_addr = gdb.parse_and_eval("$tp") > > + return current_task_addr.cast(task_ptr_type).dereference() > > else: > > raise gdb.GdbError("Sorry, obtaining the current task is not yet " > > "supported with this arch") > > -- > > 2.20.1 > > > >
diff --git a/scripts/gdb/linux/cpus.py b/scripts/gdb/linux/cpus.py index 15fc4626d236..6825a9834394 100644 --- a/scripts/gdb/linux/cpus.py +++ b/scripts/gdb/linux/cpus.py @@ -173,6 +173,9 @@ def get_current_task(cpu): else: raise gdb.GdbError("Sorry, obtaining the current task is not allowed " "while running in userspace(EL0)") + elif utils.is_target_arch("riscv"): + current_task_addr = gdb.parse_and_eval("$tp") + return current_task_addr.cast(task_ptr_type).dereference() else: raise gdb.GdbError("Sorry, obtaining the current task is not yet " "supported with this arch")