From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 8VuqIt1gqGqR6AwAWB0awg (envelope-from ) for ; Mon, 14 Sep 2026 17:02:21 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=WsVbNiX1; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 89ACD1E06B; Mon, 14 Sep 2026 17:02:21 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 121801E051 for ; Mon, 14 Sep 2026 17:02:21 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D99544BB1C0D for ; Mon, 14 Sep 2026 21:02:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D99544BB1C0D Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=WsVbNiX1 Received: from mail-wr2-x10.google.com (mail-wr2-x10.google.com [IPv6:2a00:1450:4864:30::10]) by sourceware.org (Postfix) with ESMTPS id D549A4BA2E12 for ; Mon, 14 Sep 2026 21:01:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D549A4BA2E12 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D549A4BA2E12 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:30::10 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1789419716; cv=none; b=vHnTPprXY3FDR16TVRruLu2mm4rCJvDzOYUiQs9Vi1vWUxgDckv5KY+YCF84b7Epw0x10BmAFmC1p10+rDUz4jiHhVj+ENh5Ra5Y4zWtf37/MY2a3DRoz6NpUFJDdtgx34PdNnZJ7AnmTVIMFHTIWLvIv6tPSf1sh+NS2kvT9QA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1789419716; c=relaxed/simple; bh=G3yY1K+dPWG//OqKNXtBeLvd9gRKxu2VhgSeEp8xX9w=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=klL3Cz3HGARSSh2gWqDLQ2vk7hwM2afmtWvALIT4dN7XRjKfXdQbe9rLliE6Kx9Nn62VVZBTiAy6Yev+aM9WcdaZTd6I45Rthm+N5zF4o1W66L5+hTq5Odb0VXB/E+m2mH38aDb7A903Onp8BBiZxRJZgPHjzQzK18gDMBwttBY= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20251104 header.b=WsVbNiX1 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D549A4BA2E12 Received: by mail-wr2-x10.google.com with SMTP id ffacd0b85a97d-485984ebf5cso2008050f8f.0 for ; Mon, 14 Sep 2026 14:01:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1789419714; x=1790024514; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=eZUG77BGxEihUSxFdXh+aWu/CkLg2rd//A8Lu4vQxmw=; b=WsVbNiX1SbWGV/amebT/LmtuzWTmSwr3i5LPC3eCd7xWKA2sHrqnfBppe3Jzy8s0RU /wlrxQgBkoeNwzrwYbqbdiP3SSK7oVCnsQQoqNKbqi0bl0dREW2ck0bWmDh8+kz26Yhj Xxi+wR/G6Xh/0N8DRZf0ZcvDvvXnEjxm/9bWxsBtCGRQBX6NYWRkSA0FF4HRLDhWtzSc FOGnvjEzydYk6HdNWpltnJm1hyynjTkSg16u+3mxtS8AYXOuF/Vmj9VCo4ChTQzxf5Xd Ee85ZGsi4CYENYTRlbxMr8ITLondWor43dQoVoXQ2rqPUIL9rFWbi5rzpfXMKE0aNpTb gI1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1789419714; x=1790024514; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=eZUG77BGxEihUSxFdXh+aWu/CkLg2rd//A8Lu4vQxmw=; b=IiqXrhlgvZ4nI+VNW6+uo2ck1d1MeLtDuxVSXnNUwDwjkxI2KLCtoHpTZ7oKqpw03h FtmueCTxWcWXKphmCHKI8NI7flQDCgr2XTyzDO1Zi/q7uTkOKUbRq7BzsFUN9Aiwy0ND possk7Nf+/EiQ5ZfdBHXVKBcQPp7F6ljEaosDyQ4Ijgs1HM6hbZ2py19uCRmlNXCLZQY zDXv01giaskOVcdibNPBcWnclWBuOMxT0Onj8mpOMnbZFxRpbBOW4lNLfsYhLXJBVolI vL7q78DqiyBjdP8JFxwnohfz3gEC8xMSbm9ffLyza7sP01IqFJjL0Skpd6CDP6in7vyK jnGw== X-Gm-Message-State: AFuF++nSv0OROqpJhY5c9RqcwabrvCikFOk4lbStZ2EBM3ah4R4rNfEa KEO+ZXfZwIP8fP3cKFD3sPyH/QZQ0kaeDf3uqJjejlLQCrxzXaGEs/Ep X-Gm-Gg: AYBFou3ZLB9QjhJqZrAiKM5FUQooAqoe0DPnNHrRUK9DUu6zJ8uyuo/X9J2zlFLY8e8 LfCGcfTYbCrYFUCGQA6ZcJDyBRnDvk2DZW18bpy9sAxogb6mjwFjn6MfI+FwOLSlTwcEvtPgOfZ yfpDD5A0RkYBDdi1dPpTWpfeSe6xEZe7ptDlcWGDpc+C0DRXfHwwAJy4db/k4OoX2I1Yt3CORg4 CGdkBhsrBgoKxYqFdy9Hb15hXIpcaol/zScEf58UZSUPjfPZS8IsZt2DBW6x8nvd3fnNgFHwEBM S+8c6Lg+VpLbkRt+FoISiHQE8hkKhad9E5mO1M8PICSMkZNS+/MRhjXA69bfDb4NZOQdFgGyKjR 6l6LKhSUUvjnoP93rRptB2x3k03qEaiqV4wo8w5urkDs8wCil0C0kM+ZH5J9MAjCIg+vFGlU/nf V3//OQYsscR4bxmCxtJBRBYVr8E1jxRKBC4mBnZARCX1jZXo9RJ9LBpa0DEFRYr2JCyjPLr+vDG g== X-Received: by 2002:a5d:588e:0:b0:486:f9d9:fe0d with SMTP id ffacd0b85a97d-48702b0808amr5726407f8f.29.1789419713954; Mon, 14 Sep 2026 14:01:53 -0700 (PDT) Received: from curiosity ([80.211.22.60]) by smtp.googlemail.com with ESMTPSA id ffacd0b85a97d-486eb33ea4fsm30756383f8f.21.2026.09.14.14.01.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2026 14:01:53 -0700 (PDT) From: Sergey Matyukevich To: Kirill Radkin Cc: gdb-patches@sourceware.org, Ilya Mamay , Sergey Matyukevich Subject: Re: [PATCH 1/2] RISC-V Vector Extension Support Date: Mon, 14 Sep 2026 23:58:27 +0300 Message-ID: <20260914210132.439986-1-geomatsi@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20251107165534.1688124-1-kirill.radkin@syntacore.com> References: <20251107165534.1688124-1-kirill.radkin@syntacore.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org Hi Kirill and all, Thanks for working on this! I am not subscribed to gdb-patches, so please keep me in CC. Just wanted to let you know that some time ago Ilya Mamay and I implemented some bits of related functionality in the Linux kernel, see [1]. Those changes are in the Linux kernel mainline since v7.0. The parts of those changes that may be relevant here are as follows: 1. NT_RISCV_VECTOR now returns -ENODATA instead of -EINVAL when the V extension is supported but not yet activated for the tracee. EINVAL is now reserved for "V not supported at all". This was changed specifically to match what gdbserver already expects. Before this change kernels returned EINVAL in both cases. 2. vlenb in the vector context is now initialised correctly rather than left zero until the first context switch after the state goes dirty. Before that change early attach with ptrace could see zero vlenb. 3. PTRACE_SETREGSET on NT_RISCV_VECTOR now strictly validates the input vector CSRs. The attempts to set reserved bits or invalid fields combinations are rejected. Also strict VL checks are enforced against calculated VLMAX values. Our kernel patch series also added a new selftest that exercies exactly those paths, see tools/testing/selftests/riscv/vector/validate_v_ptrace.c in the kernel source tree. The v_csr_invalid and v_csr_valid fixture variants there document what the kernel now accepts and rejects, which may be useful as a reference. I tested our kernel changes on rv32/rv64 qemu and on RISC-V hardware including c908 (RVV 1.0) and c906 (XTheadVector 1.0 which is close to RVV 0.7.1, see [2]). So let me know if I can help with testing your gdb patch series on the same platforms. Finally... 1. IIUC despite our changes, you will have to support both behaviours for a while in order to support older kernels =( 2. Could you please check setup_vector_regset in your patch. The vlenb is in bytes, so either do not multiply vecreg_size by 8 or multiply sizeof by 8 as well (e.g. if you need bits). [1] https://lore.kernel.org/linux-riscv/20251214163537.1054292-1-geomatsi@gmail.com/ [2] https://github.com/XUANTIE-RV/thead-extension-spec/blob/master/xtheadvector.adoc Regards, Sergey