From patchwork Fri Feb 21 14:57:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 13985645 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7E885C021B5 for ; Fri, 21 Feb 2025 14:57:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=C0+VCgio1tUjlLnBhjdP1KU//uFP0aIvLX5Mxj6nLmk=; b=PGQ6uCe73FxKeq bI0WdWqpB2WLkkHKjv8XB+yoWATbTLu0U/PsHVi+c/0Aw0LrhztVmxauJdMyOSjyNL3rRx+MaVsvW hiaCmRn4RERhhON6BG7M9ITLuzK7FVJIwhzjCvg6/MUQDXyrkjdj2jJKW8IEG05GqOFvwYdV8kff5 HIvw59GUABunCqnShhvltFEbx9IKaMHpSNtVkAs1buHSvArAUNRS0/U6Qrlg00zv1Iuaz1i5tH19d RDOzAwUFmfIDyIefCsiuGJUuVUBc1NbducFaTgwUVPvvA+aixyH5lNArZLRow4UxTO7rrNijeR+66 Eva1oqxHstxBiYarp84A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tlUT3-00000005tug-2UjV; Fri, 21 Feb 2025 14:57:29 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tlUT1-00000005tsk-10xJ for linux-riscv@bombadil.infradead.org; Fri, 21 Feb 2025 14:57:27 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=dsOXXT+GJOZQxfHaJbyOnCfiUI8BUwrK26GnKW4Oj7U=; b=p8mgNwIKFJvzOfAlqCZZ91rf0n hbwyhvebgWu/6WGd2nIr54Up4dIqTjCaB8EpAZU21r3KkFMMHxsF9dcATXCNvkerh24BT5AcPyWyi 19DV2vIZEPvPkWVQhqxoT1D7kh++siXqTEqkCX4wh6f30HoWjBDTNp6utTs15Als7IbC1yuA+KZWh peM1PJdT2rPR+TnhOJe7V8bQhq6yyo8S4Gyblh0KOA2MU3AwiOeLsoFa5/QMT5HTyxuwSNYyApV3h NzDL2xzFRIhv1zv24GTVdgdCb8Fe1flq/YKdC2tw15GQhN+1DfZC/ctQf8RLrH9FM/DnrXicQ+HAk bKWsU62w==; Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]) by desiato.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tlUSy-00000002em3-0Rlu for linux-riscv@lists.infradead.org; Fri, 21 Feb 2025 14:57:26 +0000 Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-43937cf2131so15376775e9.2 for ; Fri, 21 Feb 2025 06:57:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1740149841; x=1740754641; darn=lists.infradead.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; bh=dsOXXT+GJOZQxfHaJbyOnCfiUI8BUwrK26GnKW4Oj7U=; b=m7nEiHhC8Gz9QsJGVo0T3Q0zMLNVA7oH+dxD4zpcbfl7e1b6GK+XjZJFzbMwN++S9X ruEq338gbaceDWrsDRVXNlHtWgQHOAfdGQBfA6wwe7OdHCfKNO49L8Qe6jBVTdlU6ddK hDHI3qSIsRNR/Shm6M6yKXhXbnuWn6wvarTKOj8pl+yiNu3exYtt+V/+KH2y5zqaiHuR 2vAbvPdi+lIYAm3/zOnHO/5YcEgpYKoYYO/1e9Fk+Nyt0njCPECnO3DLdHZPVRyrrqfy jOidxl6jq3WRfSxuqf8iwGftv2028eysNdWllQwpHex7uM2Is/Itc96lE2exvoxiDXpd 7fnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740149841; x=1740754641; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dsOXXT+GJOZQxfHaJbyOnCfiUI8BUwrK26GnKW4Oj7U=; b=mCpIbSv5UInqdcIYYBuVKxyX3Zb3rtyZ4Qg2uWCI900xasZuqPTBVpxyng6ZdSrqak aXJ8ZaXMXJHvW8GB2+HDi5kXMifah6nEWAn2R4nNnjDinMvMo29TB88m5OzMpa/QVlSU mURHGPoxRwql6xHy+Zb/Hffk/n43o6feW7x8hMN3CnCC0Te4qUpo+lpRlEb/IrGrCpMh HmmBUz2VfkjiWUjn2e2vhJXcTNOUbiH87qvwTAdLhb6qXTZlbvY/Z6TEma3/HJZHPbLu PUB+PbfaEb3Gs1pfo9mUfYI8fbSt4WaiJrzVKFaTH1KrtEXb01w0xMK9AIS/Xk5OPK1e 2RQQ== X-Gm-Message-State: AOJu0Yx8nkA17hvpeflGGi/HGlTI9Vfdr/sfStY0SSnazgW1/Aj0S30Z 51PCM3BNJwaTKuMt/T94SNqLaXcYMJiKstqvr3IuyvOBbKvro43LkkbhmNOMv+GF4tE43iDZ8nK 8 X-Gm-Gg: ASbGnctCSobuF8nM+34jg/2p78aJv/f6Btz7l49FjW+S6dfRCNrzqcA+TWQBevikOFo tX12bL7t6qz5CWcbjCuD7TYjylHqkLamOSjj027P603R2ahzflnzFy12YzOY26pfPu2jOy+o99A bIrg/i4RiN4YBFe9CJwLwdfe3G9RxK3UI+ymvadUKXPoMHwTiDGACE4XaiRIH6tT1NZ5R574oLl aT9WAVIijwBnrt0SDG6Et9Q+Eso/VkraEpk/G1AjJAXORC0S/c2HsCNJBYGkRgGY0RsHRkI5hyB 3NHeS7gZClJuKA== X-Google-Smtp-Source: AGHT+IEUliwq1ZDyhNRp6iD5CU1s2Dr/5eTi3CQW3MEFV44buTgl2XlBAKDpdOkuwjiNC2NjVPRKIA== X-Received: by 2002:a5d:584f:0:b0:38f:1e87:cc6e with SMTP id ffacd0b85a97d-38f6e74f270mr3231891f8f.9.1740149840969; Fri, 21 Feb 2025 06:57:20 -0800 (PST) Received: from localhost ([2a02:8308:a00c:e200::766e]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38f74817cbdsm1344912f8f.68.2025.02.21.06.57.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2025 06:57:20 -0800 (PST) From: Andrew Jones To: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, charlie@rivosinc.com, cleger@rivosinc.com, alex@ghiti.fr, Anup Patel , corbet@lwn.net, Alexandre Ghiti Subject: [PATCH v2 1/8] riscv: Annotate unaligned access init functions Date: Fri, 21 Feb 2025 15:57:20 +0100 Message-ID: <20250221145718.115076-11-ajones@ventanamicro.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250221145718.115076-10-ajones@ventanamicro.com> References: <20250221145718.115076-10-ajones@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250221_145724_365024_786FF308 X-CRM114-Status: GOOD ( 10.19 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Several functions used in unaligned access probing are only run at init time. Annotate them appropriately. Fixes: f413aae96cda ("riscv: Set unaligned access speed at compile time") Reviewed-by: Alexandre Ghiti Signed-off-by: Andrew Jones --- arch/riscv/include/asm/cpufeature.h | 4 ++-- arch/riscv/kernel/traps_misaligned.c | 8 ++++---- arch/riscv/kernel/unaligned_access_speed.c | 14 +++++++------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/arch/riscv/include/asm/cpufeature.h b/arch/riscv/include/asm/cpufeature.h index 569140d6e639..19defdc2002d 100644 --- a/arch/riscv/include/asm/cpufeature.h +++ b/arch/riscv/include/asm/cpufeature.h @@ -63,7 +63,7 @@ void __init riscv_user_isa_enable(void); #define __RISCV_ISA_EXT_SUPERSET_VALIDATE(_name, _id, _sub_exts, _validate) \ _RISCV_ISA_EXT_DATA(_name, _id, _sub_exts, ARRAY_SIZE(_sub_exts), _validate) -bool check_unaligned_access_emulated_all_cpus(void); +bool __init check_unaligned_access_emulated_all_cpus(void); #if defined(CONFIG_RISCV_SCALAR_MISALIGNED) void check_unaligned_access_emulated(struct work_struct *work __always_unused); void unaligned_emulation_finish(void); @@ -76,7 +76,7 @@ static inline bool unaligned_ctl_available(void) } #endif -bool check_vector_unaligned_access_emulated_all_cpus(void); +bool __init check_vector_unaligned_access_emulated_all_cpus(void); #if defined(CONFIG_RISCV_VECTOR_MISALIGNED) void check_vector_unaligned_access_emulated(struct work_struct *work __always_unused); DECLARE_PER_CPU(long, vector_misaligned_access); diff --git a/arch/riscv/kernel/traps_misaligned.c b/arch/riscv/kernel/traps_misaligned.c index 7cc108aed74e..aacbd9d7196e 100644 --- a/arch/riscv/kernel/traps_misaligned.c +++ b/arch/riscv/kernel/traps_misaligned.c @@ -605,7 +605,7 @@ void check_vector_unaligned_access_emulated(struct work_struct *work __always_un kernel_vector_end(); } -bool check_vector_unaligned_access_emulated_all_cpus(void) +bool __init check_vector_unaligned_access_emulated_all_cpus(void) { int cpu; @@ -625,7 +625,7 @@ bool check_vector_unaligned_access_emulated_all_cpus(void) return true; } #else -bool check_vector_unaligned_access_emulated_all_cpus(void) +bool __init check_vector_unaligned_access_emulated_all_cpus(void) { return false; } @@ -659,7 +659,7 @@ void check_unaligned_access_emulated(struct work_struct *work __always_unused) } } -bool check_unaligned_access_emulated_all_cpus(void) +bool __init check_unaligned_access_emulated_all_cpus(void) { int cpu; @@ -684,7 +684,7 @@ bool unaligned_ctl_available(void) return unaligned_ctl; } #else -bool check_unaligned_access_emulated_all_cpus(void) +bool __init check_unaligned_access_emulated_all_cpus(void) { return false; } diff --git a/arch/riscv/kernel/unaligned_access_speed.c b/arch/riscv/kernel/unaligned_access_speed.c index 91f189cf1611..b7a8ff7ba6df 100644 --- a/arch/riscv/kernel/unaligned_access_speed.c +++ b/arch/riscv/kernel/unaligned_access_speed.c @@ -121,7 +121,7 @@ static int check_unaligned_access(void *param) return 0; } -static void check_unaligned_access_nonboot_cpu(void *param) +static void __init check_unaligned_access_nonboot_cpu(void *param) { unsigned int cpu = smp_processor_id(); struct page **pages = param; @@ -175,7 +175,7 @@ static void set_unaligned_access_static_branches(void) modify_unaligned_access_branches(&fast_and_online, num_online_cpus()); } -static int lock_and_set_unaligned_access_static_branch(void) +static int __init lock_and_set_unaligned_access_static_branch(void) { cpus_read_lock(); set_unaligned_access_static_branches(); @@ -218,7 +218,7 @@ static int riscv_offline_cpu(unsigned int cpu) } /* Measure unaligned access speed on all CPUs present at boot in parallel. */ -static int check_unaligned_access_speed_all_cpus(void) +static int __init check_unaligned_access_speed_all_cpus(void) { unsigned int cpu; unsigned int cpu_count = num_possible_cpus(); @@ -264,7 +264,7 @@ static int check_unaligned_access_speed_all_cpus(void) return 0; } #else /* CONFIG_RISCV_PROBE_UNALIGNED_ACCESS */ -static int check_unaligned_access_speed_all_cpus(void) +static int __init check_unaligned_access_speed_all_cpus(void) { return 0; } @@ -379,7 +379,7 @@ static int riscv_online_cpu_vec(unsigned int cpu) } /* Measure unaligned access speed on all CPUs present at boot in parallel. */ -static int vec_check_unaligned_access_speed_all_cpus(void *unused __always_unused) +static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __always_unused) { schedule_on_each_cpu(check_vector_unaligned_access); @@ -393,13 +393,13 @@ static int vec_check_unaligned_access_speed_all_cpus(void *unused __always_unuse return 0; } #else /* CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS */ -static int vec_check_unaligned_access_speed_all_cpus(void *unused __always_unused) +static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __always_unused) { return 0; } #endif -static int check_unaligned_access_all_cpus(void) +static int __init check_unaligned_access_all_cpus(void) { bool all_cpus_emulated, all_cpus_vec_unsupported; From patchwork Fri Feb 21 14:57:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 13985910 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 89ACEC021B5 for ; Fri, 21 Feb 2025 16:11:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=I1DnT6sZyI5qTF4jDohntVLmIllhQRLXXojCtZHnxVs=; b=gxhfeaDIbFI6co htBPbfgftffcebzmECWbUfkTPypRLX5LO9jvmt+/GQtXAnIr+d44VjR7GfUqPsazAuEcBi7FcZ3sS a+EvXrI24B+TRN6rJJu7PtSspq03rWExINC2r48sn3fXPfgddNOalv6FmXSg02OIj9MMmefsO5pHH GB7bVnK/cAKFrLlBEQUEErBBdBSBc7A4ffNqTRsl+X6Vq2yGyfKUWcYqWsf3qyXGpQGZDyoTXWQTA BUR/SMEWF1pVUgZoi/ZpmqtRHOEI2SLjvx22hYgM4jMUHQCxFKV+q2ecQBDze/xdLmBgZPzkoiCTB NLamd3cuSOYTVVEC8oyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tlVch-000000066ii-0ab8; Fri, 21 Feb 2025 16:11:31 +0000 Received: from mail-wr1-f45.google.com ([209.85.221.45]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tlUSy-00000005tre-0qFd for linux-riscv@lists.infradead.org; Fri, 21 Feb 2025 14:57:25 +0000 Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-38f325dd9e6so1139004f8f.1 for ; Fri, 21 Feb 2025 06:57:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1740149842; x=1740754642; darn=lists.infradead.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; bh=XoVXTPIMs1CQCffXwitKYw9GB5bSc15mRPYc+pFsBJQ=; b=TU3avR9mzmXUvg8dwj/JdJTeL4Q7QywqV1qvLP/geHjHXkkNVv7+svXpNYeJGPRJV6 DbraNTMBp35JQ9CDJ4ISbyQln7ZQF9cv4hV49yRbQgl6gOSHmMNVvjHCe0NdG0M/fzNd OFM6x/5H/LDtemiLiu56nHRyiTwWZ0igbjdTn7CBS3oZBEMrE5AdWRmCOZTHe4THdfcw 45mIOTHZtCUO1980ORqzlQ0LnXzZm9k79wrw98KNwsmmP+zpU6KltbL/xPkLNq+U/0xg q4mBYm+12y2rZFoDOP0QV9e8WP9hbXD0sCYPDcI6A4qmaE1Bz04VSonwDHrtd+Y+zPBe Ia7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740149842; x=1740754642; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XoVXTPIMs1CQCffXwitKYw9GB5bSc15mRPYc+pFsBJQ=; b=Y3aRXQLimZgOYiXCDi//UH0lNBJJqZBjvHh1cYypl0hYTPdcO4I6ZDJckjiyjPvkYg Qa0CITZkeZlUUvnDxFLQz2uHDbv5UrJbgjN8h/RyDxwexRQtSWy6LfjXKI+rZQ2r1Ab6 Y8tOUPHKcGWc2sIDLjS8gjer1lG/T+MgMH8YR82mqD8iEmJqUDV7OAL9fR9rCoqI3RqE gAz3GQQAiQquJbgOo003uHw17LL6bjt7hF3pnN31zYgKa0wv/caU1J9yLUt6z0zGXO1D AHieDkAJj0Z9rX7Oq0vS8gDq3S8qIlTBFWtkdnG7erskuERYQNJ8NI9pOxaoND5PVXZG 2I5g== X-Gm-Message-State: AOJu0YzYB0ooKfHAjNb1ffSYkgKsAEyEj6x6kIdWaF+Yal1s9niVSDeB GCR17st0o3cFYXuUmiIDBkYqqogWnqCyXv0zNFjgSjwbGa6Oa+K151RerQ/vmb3iZ28YNJDndTn 3 X-Gm-Gg: ASbGncsIJZ3SiWspd3jG7zRTdN0oSGMzAS39JnE17d948MGTqQUNpoYR84ETOUEYzAH X3iklXYBBm9cmidYbpzcxMgt5OKbWjFlI7E9i6A+49cqSHaGykM5lV32ShCLK8O5YeXEIcqpLOh xIlGzG2NtZXTyjZis5i0iGVU+uComNcADnwNZKRl7OgLvEQMnfLUpLMbXd+NvAA/Di1h4QqACAs 62rAVJF1koUeDLyuvrgslysZFxW0e30GQH6cWawt9olKFzzKtd7UjkZ98UoSBzy7hHHSnZ2/kSM aNb+BEK7n8u7xA== X-Google-Smtp-Source: AGHT+IGLjeXtLMpaUfMeTJi1dFbDUAJnf03JHPPfMuqHzy+Icmy6f1wZrpg8Ii10se+UcAaYlTJT4w== X-Received: by 2002:a5d:584b:0:b0:38f:3b41:c952 with SMTP id ffacd0b85a97d-38f6e754b82mr2673644f8f.4.1740149842284; Fri, 21 Feb 2025 06:57:22 -0800 (PST) Received: from localhost ([2a02:8308:a00c:e200::766e]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-439b0371c67sm19561065e9.34.2025.02.21.06.57.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2025 06:57:21 -0800 (PST) From: Andrew Jones To: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, charlie@rivosinc.com, cleger@rivosinc.com, alex@ghiti.fr, Anup Patel , corbet@lwn.net, Alexandre Ghiti Subject: [PATCH v2 2/8] riscv: Fix riscv_online_cpu_vec Date: Fri, 21 Feb 2025 15:57:21 +0100 Message-ID: <20250221145718.115076-12-ajones@ventanamicro.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250221145718.115076-10-ajones@ventanamicro.com> References: <20250221145718.115076-10-ajones@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250221_065724_235289_2893C1E5 X-CRM114-Status: GOOD ( 11.75 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org We shouldn't probe when we already know vector is unsupported and we should probe when we see we don't yet know whether it's supported. Furthermore, we should ensure we've set the access type to unsupported when we don't have vector at all. Fixes: e7c9d66e313b ("RISC-V: Report vector unaligned access speed hwprobe") Reviewed-by: Alexandre Ghiti Signed-off-by: Andrew Jones --- arch/riscv/kernel/unaligned_access_speed.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/riscv/kernel/unaligned_access_speed.c b/arch/riscv/kernel/unaligned_access_speed.c index b7a8ff7ba6df..161964cf2abc 100644 --- a/arch/riscv/kernel/unaligned_access_speed.c +++ b/arch/riscv/kernel/unaligned_access_speed.c @@ -367,10 +367,12 @@ static void check_vector_unaligned_access(struct work_struct *work __always_unus static int riscv_online_cpu_vec(unsigned int cpu) { - if (!has_vector()) + if (!has_vector()) { + per_cpu(vector_misaligned_access, cpu) = RISCV_HWPROBE_MISALIGNED_VECTOR_UNSUPPORTED; return 0; + } - if (per_cpu(vector_misaligned_access, cpu) != RISCV_HWPROBE_MISALIGNED_VECTOR_UNSUPPORTED) + if (per_cpu(vector_misaligned_access, cpu) != RISCV_HWPROBE_MISALIGNED_VECTOR_UNKNOWN) return 0; check_vector_unaligned_access_emulated(NULL); From patchwork Fri Feb 21 14:57:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 13985649 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5BB95C021B7 for ; Fri, 21 Feb 2025 14:57:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GkR79wiuhsu0+PIfkmWVmXvotHR7UmV5EAxnnDOMpEY=; b=cgRfK3moPvimd3 wC5MNcMeaMKy5S8KJIcwoTOZmwNg0AeEMO3Mg/2hy9+6hqeFz1MwZ4oak5oR8+0zwOYXyZmlBShPK zKFRG2MEvK1fCJ0Y74vAXUonxdO6l7rQiPxjfYaoM734sA5s75N7zKl4S07dJdFAEum9a5RUR5Gig 3Wu5Traxk5PnZyOjwe1wOGhs6femhKzLdktMWaBMO7+4ej+kEPvFmkE6Wx57f/JIgu9aDhLXNiSrn cTwoGaDdklcA78sQW4YDJasLuWihm3Z4RrYmxRV54hsTkkrEWEo9NzYIwVPaViaNI5XcsgVABtNgi gj7G0D9mqa9/IWmmdaog==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tlUT3-00000005tuU-05pf; Fri, 21 Feb 2025 14:57:29 +0000 Received: from mail-wm1-f50.google.com ([209.85.128.50]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tlUT0-00000005tsH-19a6 for linux-riscv@lists.infradead.org; Fri, 21 Feb 2025 14:57:27 +0000 Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-4398ec2abc2so19138705e9.1 for ; Fri, 21 Feb 2025 06:57:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1740149844; x=1740754644; darn=lists.infradead.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; bh=BL25umXnpXBBzwUoMnOj2fRLliDIrDaDucRmmKK49J0=; b=GV+WewvjNCU/3MFiU7XzuHLekd0aLKfyMw1XxRg7T2hmb4xJj8zAOwF3b7+VkRDZmv Xi9MVCIRcMQRCthCCtixmQ8R9xnYsX42SgtzMFjG9AluE3n9O/IcFS/KdA4BI03W5YQa lrh3kKDdjCMRNz7Pw0yhQ3AtNCEs7Qq3a9HQbAgmI99/NSVTKd6avuZzYbw/HUOttJS0 j5RBQA64MtkDLXrg+KOKrvo864dIpR4MHeZ8samerR6aD7SXcF5SkKKHC6jYl/vkywUr jFw7EbBMGfBi1mg8UVCpenXgJe9ij6EDHO4qiOKlyatA24dqC7WOhNrh1G+BYC9vI2LO xZMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740149844; x=1740754644; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BL25umXnpXBBzwUoMnOj2fRLliDIrDaDucRmmKK49J0=; b=e0FpOQ5jTzuGHvLzucOpYdD4UIBD48R+x81v6xJa+jGgXPb08N4vFt6Ko5ev3u9Ley yzaHGPGDipZxF+org2p72OX4peApfRetQJe7uRIzXNoR6KZ4Ypu1id1+fq6RkBC1K8+X siSaaxmpJlEqDDTl8dwHX7jh89W/FXPJdJgA04hiME6URi4WQWYawkfaQ+qBaSVTPbyL lf1IJ3QtXAyXCT32NPsJCTpsSR4/cncfSdjwwVJ8OVn+6Cu/10R9wMwvyWf+EsNDrf+4 FT+mqSUqLqj1oGXWE+hsBYaIYZoroEcesFXYyx8JnujKemustcCkRCFwmom884i1BGPA YMTw== X-Gm-Message-State: AOJu0Yzk8xtCAZ30Y1Ipoav7LYcLCqzN7+0GX8VLnHYgBVbVNtlDkn4X 5WN7OvSqF3JgYG84B45o0/tuE1Ui3h1OexRTCyjqA0nESCXkTHwHOR45I9F+TqwqRyaz4o+rBrb H X-Gm-Gg: ASbGncvpgvD4z2yWBH1RwVVLFCGxmRGHJ/3t9trWY80Twxo7B4XMNcKb27SAUzCWcee hOT2Cu72fyWyXhqpkGhK40MCXmmXh4nePyGuDfcuRP3k8aov3qOX/7RRGvRF6htBnozaeMK3eoW QXyaLa0y6Tv/u1KnXfAMTkrKlc7QQZChIxEVaawdNXYr+1Or8FMpZF3nN3e2M7CZFUwXfcYHMiu StV9bjUEWdxyaBxGtNg9cQ0WCFzHX4xQIj2a02w9I7kMrh9AlBWNeHp9A4Ian7D3QGUDK+w0Y35 BYh60v3+cwdI+g== X-Google-Smtp-Source: AGHT+IEUAirr8QCvcHPxcSxcdTz/htKaV3QDGHz78tljhwlnJaYoBkEeV24i5MRcuIDBul2oYPovkA== X-Received: by 2002:a05:600c:4e8d:b0:439:643a:c8d5 with SMTP id 5b1f17b1804b1-439ae189b90mr35989955e9.0.1740149844345; Fri, 21 Feb 2025 06:57:24 -0800 (PST) Received: from localhost ([2a02:8308:a00c:e200::766e]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-439b02ce740sm19898235e9.4.2025.02.21.06.57.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2025 06:57:23 -0800 (PST) From: Andrew Jones To: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, charlie@rivosinc.com, cleger@rivosinc.com, alex@ghiti.fr, Anup Patel , corbet@lwn.net, Alexandre Ghiti Subject: [PATCH v2 3/8] riscv: Fix check_unaligned_access_all_cpus Date: Fri, 21 Feb 2025 15:57:22 +0100 Message-ID: <20250221145718.115076-13-ajones@ventanamicro.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250221145718.115076-10-ajones@ventanamicro.com> References: <20250221145718.115076-10-ajones@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250221_065726_311933_003E8636 X-CRM114-Status: GOOD ( 12.04 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org check_vector_unaligned_access_emulated_all_cpus(), like its name suggests, will return true when all cpus emulate unaligned vector accesses. If the function returned false it may have been because vector isn't supported at all (!has_vector()) or because at least one cpu doesn't emulate unaligned vector accesses. Since false may be returned for two cases, checking for it isn't sufficient when attempting to determine if we should proceed with the vector speed check. Move the !has_vector() functionality to check_unaligned_access_all_cpus() in order for check_vector_unaligned_access_emulated_all_cpus() to return false for a single case. Fixes: e7c9d66e313b ("RISC-V: Report vector unaligned access speed hwprobe") Reviewed-by: Alexandre Ghiti Signed-off-by: Andrew Jones --- arch/riscv/kernel/traps_misaligned.c | 6 ------ arch/riscv/kernel/unaligned_access_speed.c | 11 +++++++---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/arch/riscv/kernel/traps_misaligned.c b/arch/riscv/kernel/traps_misaligned.c index aacbd9d7196e..4354c87c0376 100644 --- a/arch/riscv/kernel/traps_misaligned.c +++ b/arch/riscv/kernel/traps_misaligned.c @@ -609,12 +609,6 @@ bool __init check_vector_unaligned_access_emulated_all_cpus(void) { int cpu; - if (!has_vector()) { - for_each_online_cpu(cpu) - per_cpu(vector_misaligned_access, cpu) = RISCV_HWPROBE_MISALIGNED_VECTOR_UNSUPPORTED; - return false; - } - schedule_on_each_cpu(check_vector_unaligned_access_emulated); for_each_online_cpu(cpu) diff --git a/arch/riscv/kernel/unaligned_access_speed.c b/arch/riscv/kernel/unaligned_access_speed.c index 161964cf2abc..02b485dc4bc4 100644 --- a/arch/riscv/kernel/unaligned_access_speed.c +++ b/arch/riscv/kernel/unaligned_access_speed.c @@ -403,13 +403,16 @@ static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __alway static int __init check_unaligned_access_all_cpus(void) { - bool all_cpus_emulated, all_cpus_vec_unsupported; + bool all_cpus_emulated; + int cpu; all_cpus_emulated = check_unaligned_access_emulated_all_cpus(); - all_cpus_vec_unsupported = check_vector_unaligned_access_emulated_all_cpus(); - if (!all_cpus_vec_unsupported && - IS_ENABLED(CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS)) { + if (!has_vector()) { + for_each_online_cpu(cpu) + per_cpu(vector_misaligned_access, cpu) = RISCV_HWPROBE_MISALIGNED_VECTOR_UNSUPPORTED; + } else if (!check_vector_unaligned_access_emulated_all_cpus() && + IS_ENABLED(CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS)) { kthread_run(vec_check_unaligned_access_speed_all_cpus, NULL, "vec_check_unaligned_access_speed_all_cpus"); } From patchwork Fri Feb 21 14:57:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 13985644 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 841E9C021B6 for ; Fri, 21 Feb 2025 14:57:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KGYBBpwnt3hWw/5C3fwSPGMNcDYClNDq6N78sbu4zpg=; b=Wu3WiY9dZNumt9 /S9yb6gL2TTm5ARkfxNkHX5MuQOK7tvNGMayBWDcYBmYceH+qyxCPBO82vEXof0L8ty+6YTRS/ZbB 6d1oxa2pSm5XLGxqTTKCPTTgATDbSCblpsJBV45Q/W4RN+GgyimJNQy2HqinkUhn9QvqsPZUhIhnn mjVI2b12Sj/bCzkdVkok8tieXQh1uHE9Fo8GneTTvNZuu3JW4K2czlATLHHC+VFSUSArlRhgkIb7A d53iV6KEWlrG4xsLVH225jCIoskBcSLf/i1eDyT69nVAOXuSdmYMlPw+Uq3xDHIdSe/rKColu2K7J c49zn73Z1hHOfLHbcznA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tlUT5-00000005twK-1Ffr; Fri, 21 Feb 2025 14:57:31 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tlUT1-00000005tsT-0wRo for linux-riscv@lists.infradead.org; Fri, 21 Feb 2025 14:57:28 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4393dc02b78so15363915e9.3 for ; Fri, 21 Feb 2025 06:57:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1740149845; x=1740754645; darn=lists.infradead.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; bh=v5+0DAJFyGg9dqAHMt/74M2g7aCiRWRLOEFqoe5G5I8=; b=P1s0LBllVdxbGkUnvinqD0mpuFny0PGjdIe9xGPhr6bwi9Y1iYjrHJ1hEx72aWf8BE g8tVbYolxY2qBNkJM8QI9wu0crDhvt+t1OxPh42rVAyRnXeqpgeB78qo+l1I2FMVu/Vj XNwJoxFeYOOinRmTI3GkY74hkK4EPBUDtyT2T9AzjdmTqLa9pWx2BoCz78O1CXY3mVQT vj6f05colO1YsvOR+/NEF+8NMkTKMRzGSY11n6w4qW435L8oUpCeOFx9zzimIybSODGb xGxU0N8Dmo8MbCsjwVAbwsxvqmuaKlVOxyTsIx1nvFg90pGfQm31e84TrD8Vaa+T/Vuy T71Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740149845; x=1740754645; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=v5+0DAJFyGg9dqAHMt/74M2g7aCiRWRLOEFqoe5G5I8=; b=dxTDwH8EC21hfUUq+wTxyexSLp4ZsbNM74+edqschnh1Efbda71TntkD9Lf9nUuFUr U57iSTzsLGXegQ6FfSrw1z6ySGF9vdxymu0xthNi314AinLA6TTp2now2cjuGc6AjqEC +DVeGakVgA1+ajBWAWd4sLUO11dVbZ5LB6l5klipH7iH8muJeVaIQobPizVGgL4mvZdT JR/F2gsWbJ4L/JDrUJChIH0pfLvIdkT6WQ42Yxm3K2YonYk2PBKu/w3p2u+hraYjxOtt KR+b/VWrgjnvLIUPNUFUbX+zbHIoPEpp7OmZoyNWJ8VUPRBvo43iFRpQrWdn/U5FG2fd qHHA== X-Gm-Message-State: AOJu0Yw6vfNOVfTqyaQW1qM44t/494WFYdc+CXmBLzcfxg8+sdS2QgYi 2Z34EooGJ/eIMrK2Rw6+BVGHFVcc0r2hhs6T9IErWdaDQnWVi59+4eugy1jPDdrnzBzSAIn0rPy P X-Gm-Gg: ASbGncvw64CFte8XrZ41TKu7e2U9liQpSdYjDAEZ15ZmF+J8B9NZgewIUWHw4dpFdAF IxyFYtIMxhklWrrXHP69yQ9lLG/tCuxjJrTYC0uy0fv5E4glC4573gXM3QoGtISZVe92r6kQ9AE 0rr36ow5KK0tcbfz3G/5IRE8OVgbK440yncbrj/wB0oQF2EKDcCThlZgv9da27kTYrrWDihCb/O M3Uo8Ytwi+9qZl0Cdgz3KVKP3bWeWLkUjUrmAoEVZL/JIS148npUBybzSbJdAcfpDXwPxglXvOn Io2H4twaOV3ZMQ== X-Google-Smtp-Source: AGHT+IETt9kJd9Q7ffWHdL/UIZ/UKzjspmPFiByxf6WkactZKn3mvY2VzKa7KOpSc146Ehnho9+HBw== X-Received: by 2002:a05:600c:5253:b0:439:a093:fffe with SMTP id 5b1f17b1804b1-439ae1e9601mr32867375e9.7.1740149845532; Fri, 21 Feb 2025 06:57:25 -0800 (PST) Received: from localhost ([2a02:8308:a00c:e200::766e]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-439b02ce428sm20391205e9.5.2025.02.21.06.57.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2025 06:57:25 -0800 (PST) From: Andrew Jones To: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, charlie@rivosinc.com, cleger@rivosinc.com, alex@ghiti.fr, Anup Patel , corbet@lwn.net, Alexandre Ghiti Subject: [PATCH v2 4/8] riscv: Change check_unaligned_access_speed_all_cpus to void Date: Fri, 21 Feb 2025 15:57:23 +0100 Message-ID: <20250221145718.115076-14-ajones@ventanamicro.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250221145718.115076-10-ajones@ventanamicro.com> References: <20250221145718.115076-10-ajones@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250221_065727_262454_A3A3CC22 X-CRM114-Status: GOOD ( 11.55 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org The return value of check_unaligned_access_speed_all_cpus() is always zero, so make the function void so we don't need to concern ourselves with it. The change also allows us to tidy up check_unaligned_access_all_cpus() a bit. Reviewed-by: Clément Léger Reviewed-by: Alexandre Ghiti Signed-off-by: Andrew Jones --- arch/riscv/kernel/unaligned_access_speed.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/arch/riscv/kernel/unaligned_access_speed.c b/arch/riscv/kernel/unaligned_access_speed.c index 02b485dc4bc4..780f1c5f512a 100644 --- a/arch/riscv/kernel/unaligned_access_speed.c +++ b/arch/riscv/kernel/unaligned_access_speed.c @@ -218,7 +218,7 @@ static int riscv_offline_cpu(unsigned int cpu) } /* Measure unaligned access speed on all CPUs present at boot in parallel. */ -static int __init check_unaligned_access_speed_all_cpus(void) +static void __init check_unaligned_access_speed_all_cpus(void) { unsigned int cpu; unsigned int cpu_count = num_possible_cpus(); @@ -226,7 +226,7 @@ static int __init check_unaligned_access_speed_all_cpus(void) if (!bufs) { pr_warn("Allocation failure, not measuring misaligned performance\n"); - return 0; + return; } /* @@ -261,12 +261,10 @@ static int __init check_unaligned_access_speed_all_cpus(void) } kfree(bufs); - return 0; } #else /* CONFIG_RISCV_PROBE_UNALIGNED_ACCESS */ -static int __init check_unaligned_access_speed_all_cpus(void) +static void __init check_unaligned_access_speed_all_cpus(void) { - return 0; } #endif @@ -403,10 +401,10 @@ static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __alway static int __init check_unaligned_access_all_cpus(void) { - bool all_cpus_emulated; int cpu; - all_cpus_emulated = check_unaligned_access_emulated_all_cpus(); + if (!check_unaligned_access_emulated_all_cpus()) + check_unaligned_access_speed_all_cpus(); if (!has_vector()) { for_each_online_cpu(cpu) @@ -417,9 +415,6 @@ static int __init check_unaligned_access_all_cpus(void) NULL, "vec_check_unaligned_access_speed_all_cpus"); } - if (!all_cpus_emulated) - return check_unaligned_access_speed_all_cpus(); - return 0; } From patchwork Fri Feb 21 14:57:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 13985646 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C4416C021B3 for ; Fri, 21 Feb 2025 14:57:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=i9fDrrYpNE0FocQ/dpWLcBDDyuVQdM6n1DalHmOzbCk=; b=bLXG0DCn8u3kEG TyEnTBIAgpr0SGIV4hYUek2xegjRNovJo393PXzDFmjmrSGWjYy4BQIOWrnh8Or8y8FNpOKgXhKvm zBOqa4aKN8Fw2VaUXlj+Rx1PuqLYeEsyXkOW8AWvlmLDfl+9359nZ8hdGvkkYxAFqU0w9+KuR6rqU lLzyHBMvivLW5Zb5+F9lWdebw3NbbUBYHsSW+nHh9bVh2TswAiISVOUOSYE1CUewdW1MdfFzdDnNa Jm+qqdTjdNcuXS000lqtt9s/rtfjDlGZUzl57za3yLuvayUkGIKS0wFsB3RQ6y+p3kHT0KkBY3Zqf /t/cf8GuXRbIfxQ1Nv+w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tlUT5-00000005tws-3keu; Fri, 21 Feb 2025 14:57:31 +0000 Received: from mail-wm1-f46.google.com ([209.85.128.46]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tlUT2-00000005ttk-2Zmk for linux-riscv@lists.infradead.org; Fri, 21 Feb 2025 14:57:29 +0000 Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-43690d4605dso14178925e9.0 for ; Fri, 21 Feb 2025 06:57:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1740149847; x=1740754647; darn=lists.infradead.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; bh=wuV5PBYNprCWaplq1fE9KG6ZTDkt+mehdrAbLFdmJ0U=; b=et3wcMdJ/mIhYDyo1qh3IWrmTe/znuRGoQR85oAZUowY90S7IQEaIzgBLbdm1Hw62X 3v8f5Uurckx7aeva6xqvU3SwQ9ogJzmU03LVB9R3opgNrUrOIgO6lEdiav0uv6TE+r+V j6DiURMyaX38+U35Qly7Gbv5Hn8zggIe8BNuO0cQOKSCk8K75C790eDE0amj/2pVlbrZ jduljrFEdk9Fzv6atWuJ3Y2uBD59Wm/rcBqcosJa3CGI2U4vicOaZxiEzfDR1cFpm1Uz yw703HcjaicgCYxA9sg7RWBTEDXv9CXPnp1xEcIbm6I956/yPm0GpasjofD276uz1R/n Ic7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740149847; x=1740754647; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wuV5PBYNprCWaplq1fE9KG6ZTDkt+mehdrAbLFdmJ0U=; b=vMt6eWQYKQLm7qojCIPECxqKXFCtuFQ8jBqfwAjbvfetGkJRSdKerUL5dvBOGHvvti IHj4oLC4FTyuHzKKYXKMw66Nb+Nz7YLEBxky72CtySJViR0QCPXjgVRBTSwPC9nDw8o4 kxzFGqHVFfjVj1ThIMFuceXg351GULSlWeb5LQR4YmUqcJE6Ko6WpPjBcyVYsbTiRHSs T9dHzjbYXyPEP9XjO5LTc4omJN6tPgMJyrSH2iP/AUkwila4dsl/RQhXDNUBml7Uf+Xc CU7NXQG6waRogDoiJ24zf68MTWH8Gek8c68OxXw0oMCT5KsNxkJCWjfgv0dpyBHU+Qxy gMMA== X-Gm-Message-State: AOJu0YxySkkckOggRbypyQt4drNtkcnuP+/OGe/kiATXi2noVa+UGWe6 wafxxoInW2q2GNhC06PeAcscNjkvySCO/6Fr6uSmK8tU22USYcie3gLXgWtNqI5fkQnzWd1FsTA 2 X-Gm-Gg: ASbGncvHCXnD7TQ0pih1mVo1TcOtrT7mDbSUSDcYDfdhPgUCDuq6Td7t2GsKfON7d7i 7QWK+LZ5oBZHmYHfBl3b033Ir0gd5VzZKJaVWV1iiyS+cwAgroD1NWeyW98q76BWpBzVTxURK2C rs+Ri3gHc7gOgerUGUI51Wvv+JLvNfQ78mD45kK6mNWiujqqlqlkeXHE5vXBkI0Q5Eb1tx5uL1U tMFIaALFFv1dSYzAyleSXzxbJiSV4GqFdTr/KLBPCpuCRLGD7Y3Xo+EYrPEuC8d+Ef1YVOe++ua 54Fk00idaCCWxQ== X-Google-Smtp-Source: AGHT+IGHZnZDVV5eRijtS6wrNNcgTs4f/Eq2MbcFOsu4rDM5Dk/QukfiIU0puOl95OM+JkdtWtwE1A== X-Received: by 2002:a05:600c:3515:b0:439:9f42:c137 with SMTP id 5b1f17b1804b1-439ae1e6ee6mr35034335e9.11.1740149846766; Fri, 21 Feb 2025 06:57:26 -0800 (PST) Received: from localhost ([2a02:8308:a00c:e200::766e]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38f258dcf08sm23925368f8f.36.2025.02.21.06.57.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2025 06:57:26 -0800 (PST) From: Andrew Jones To: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, charlie@rivosinc.com, cleger@rivosinc.com, alex@ghiti.fr, Anup Patel , corbet@lwn.net, Alexandre Ghiti Subject: [PATCH v2 5/8] riscv: Fix set up of cpu hotplug callbacks Date: Fri, 21 Feb 2025 15:57:24 +0100 Message-ID: <20250221145718.115076-15-ajones@ventanamicro.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250221145718.115076-10-ajones@ventanamicro.com> References: <20250221145718.115076-10-ajones@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250221_065728_650895_DAA17025 X-CRM114-Status: GOOD ( 12.50 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org CPU hotplug callbacks should be set up even if we detected all current cpus emulate misaligned accesses, since we want to ensure our expectations of all cpus emulating is maintained. Fixes: 6e5ce7f2eae3 ("riscv: Decouple emulated unaligned accesses from access speed") Fixes: e7c9d66e313b ("RISC-V: Report vector unaligned access speed hwprobe") Reviewed-by: Clément Léger Reviewed-by: Alexandre Ghiti Signed-off-by: Andrew Jones --- arch/riscv/kernel/unaligned_access_speed.c | 27 +++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/arch/riscv/kernel/unaligned_access_speed.c b/arch/riscv/kernel/unaligned_access_speed.c index 780f1c5f512a..c9d3237649bb 100644 --- a/arch/riscv/kernel/unaligned_access_speed.c +++ b/arch/riscv/kernel/unaligned_access_speed.c @@ -247,13 +247,6 @@ static void __init check_unaligned_access_speed_all_cpus(void) /* Check core 0. */ smp_call_on_cpu(0, check_unaligned_access, bufs[0], true); - /* - * Setup hotplug callbacks for any new CPUs that come online or go - * offline. - */ - cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "riscv:online", - riscv_online_cpu, riscv_offline_cpu); - out: for_each_cpu(cpu, cpu_online_mask) { if (bufs[cpu]) @@ -383,13 +376,6 @@ static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __alway { schedule_on_each_cpu(check_vector_unaligned_access); - /* - * Setup hotplug callbacks for any new CPUs that come online or go - * offline. - */ - cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "riscv:online", - riscv_online_cpu_vec, NULL); - return 0; } #else /* CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS */ @@ -415,6 +401,19 @@ static int __init check_unaligned_access_all_cpus(void) NULL, "vec_check_unaligned_access_speed_all_cpus"); } + /* + * Setup hotplug callbacks for any new CPUs that come online or go + * offline. + */ +#ifdef CONFIG_RISCV_PROBE_UNALIGNED_ACCESS + cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "riscv:online", + riscv_online_cpu, riscv_offline_cpu); +#endif +#ifdef CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS + cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "riscv:online", + riscv_online_cpu_vec, NULL); +#endif + return 0; } From patchwork Fri Feb 21 14:57:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 13985648 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 38206C021B3 for ; Fri, 21 Feb 2025 14:57:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=A4SDhEzFReJxYBAatnlb+d6HWOuH1ybaHSxyWdRWTMM=; b=oZqvUdfAbYulJD Yw9wV1/UXk4G4qVba7NPg6zf1Ay3+UwTXtxS9jFEYHWpM+KO9lX9dV+Sa7IaPimTlafxphFj2CfDT p9w/Kb51TyIBLdFIAEc14V6jLDde5Lakq/7AafioILLXVNCFnG23VC/IrYHSEkbFjT7bT8xo2/FYV hUmW6afHl2yzHg2PFer/Ygt0qMRdDb5Wka7kxifetR7lLxam/bANIsKI1au+MZmLy5abIkDGdmwxH BQUmmoVgcPBDiuyvN8VfTzFizKpuK9p7YGEkayI8JKJ5ub+xgkG78TAbOSEBdSXKKSfOnALICKYNd gpyKPpELTR3IQ0e1EICQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tlUT8-00000005tyP-2BWo; Fri, 21 Feb 2025 14:57:34 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tlUT3-00000005tu7-2meM for linux-riscv@lists.infradead.org; Fri, 21 Feb 2025 14:57:30 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-4394a823036so21685685e9.0 for ; Fri, 21 Feb 2025 06:57:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1740149848; x=1740754648; darn=lists.infradead.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; bh=qKhFFnzXyWbQAGhMWM6ZzS3r16qIjR6tEgWbgaYi/y8=; b=hgwHCXjFG3qCShvo573KuOD+fz6aE3JvDtf4RqFoRdbOkWRhlR8G22DsiY6hJC2Rh2 N6ewwNmg9Pf9nxKGRXFBwCEMEN65MtT8oR6hQvNMwgoiea/S0qn13XWuysa3FivYlZBB fbcCYwsL3t2mCrbAVDMXj9gjTsJYNQM2YttCHRaGJ138/IaiItDEw2J8S7L4O2k3XzE0 OqiyTzCjauLdOG4hINRRgff/dGLgXO1FAKVaTZXAEtA1FqyjsxPT8PKul/9te3cZf3Ur gdUgbBW/PzIza061LzlCXitiXy8GJFD3weWrN9rVO0ND20TstY9Cp7Itz/joIHpPk6BH vQ3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740149848; x=1740754648; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qKhFFnzXyWbQAGhMWM6ZzS3r16qIjR6tEgWbgaYi/y8=; b=v2KYsUKeLqZdD7suK5FmJDeLt9wC9yDhGU+3BTIFwCTUZ7/b3N5hZUGt04bHWBo24b O/sB1S3tVtzmlSGrt+f5ylxKCTT5mE2v4UNdPPYW6XzEfoBfK2qcNhLOo/S0zRAHBbhj 8JCQ+qE3ozBYgwKbimWBASDUSlrDzJo+W9Pl7vYYj5gRB5sDR736+ArmBoDxlZ3YaoHN QYQSTlneaPfBHe3rXd/DANNjaXHeqacv23SSMRqUYE6QQJgLFdfSwispDcJZXuosDQKS xqSoC3juvemYbbGaIoYJUo3CsvXjsSelEKh63//mB3JEBO5oG+lkeI19H3zYZCfX65gv B7Yw== X-Gm-Message-State: AOJu0Yz/Vwxryv3XvemtXZIK9kXtwU7ELeqGF7BWrGe/ce7QfUudn9/r FjRENhzXnfs9SyTZ7otl5eysA1TSGKyoeK18UVjvxM0mAafMqRXbqz506ds502od+ruVK9BYwpJ k X-Gm-Gg: ASbGnctjklBJNgqY5CKQddFUXzSvRiu5AuI1d8S9tclJj9WsbBHaUmLh0WmsOeuD5E5 NUeRjEylCjDTj3st2tEYJzwckScQ8YSyWnbxrn4q4XNV32L3UU5Gwy420doKrQ679pDkTnQZwc7 SviZdzyELFuL11Xw+df5uPXUikzZn3EbQPaW/DLCPFWX4Rw7IBpErCZRV5njfcVXUWAL40MNreT nt7zWQwh3PZJdcRrmPFF4maFn2xZXvPW9DnRM02WC/8V2riuns9EvIMDEpTD8NWIxbrrhLLIjue fIZegxPrUFUlFQ== X-Google-Smtp-Source: AGHT+IEkXpICcfr44M3mVSGYGMJpSIpS61Nr1K7aTqNzeXftVjarUfFAfjEfBCRs4wT7c1ZnFz5qtA== X-Received: by 2002:a05:600c:470a:b0:439:a139:7a19 with SMTP id 5b1f17b1804b1-439aebb3155mr25569025e9.23.1740149848034; Fri, 21 Feb 2025 06:57:28 -0800 (PST) Received: from localhost ([2a02:8308:a00c:e200::766e]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-439b030b2c8sm19891515e9.25.2025.02.21.06.57.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2025 06:57:27 -0800 (PST) From: Andrew Jones To: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, charlie@rivosinc.com, cleger@rivosinc.com, alex@ghiti.fr, Anup Patel , corbet@lwn.net, Alexandre Ghiti Subject: [PATCH v2 6/8] riscv: Fix set up of vector cpu hotplug callback Date: Fri, 21 Feb 2025 15:57:25 +0100 Message-ID: <20250221145718.115076-16-ajones@ventanamicro.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250221145718.115076-10-ajones@ventanamicro.com> References: <20250221145718.115076-10-ajones@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250221_065729_712082_F307AFA5 X-CRM114-Status: GOOD ( 11.15 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Whether or not we have RISCV_PROBE_VECTOR_UNALIGNED_ACCESS we need to set up a cpu hotplug callback to check if we have vector at all, since, when we don't have vector, we need to set vector_misaligned_access to unsupported rather than leave it the default of unknown. Fixes: e7c9d66e313b ("RISC-V: Report vector unaligned access speed hwprobe") Reviewed-by: Alexandre Ghiti Signed-off-by: Andrew Jones --- arch/riscv/kernel/unaligned_access_speed.c | 31 +++++++++++----------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/arch/riscv/kernel/unaligned_access_speed.c b/arch/riscv/kernel/unaligned_access_speed.c index c9d3237649bb..d9d4ca1fadc7 100644 --- a/arch/riscv/kernel/unaligned_access_speed.c +++ b/arch/riscv/kernel/unaligned_access_speed.c @@ -356,6 +356,20 @@ static void check_vector_unaligned_access(struct work_struct *work __always_unus per_cpu(vector_misaligned_access, cpu) = speed; } +/* Measure unaligned access speed on all CPUs present at boot in parallel. */ +static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __always_unused) +{ + schedule_on_each_cpu(check_vector_unaligned_access); + + return 0; +} +#else /* CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS */ +static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __always_unused) +{ + return 0; +} +#endif + static int riscv_online_cpu_vec(unsigned int cpu) { if (!has_vector()) { @@ -363,27 +377,16 @@ static int riscv_online_cpu_vec(unsigned int cpu) return 0; } +#ifdef CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS if (per_cpu(vector_misaligned_access, cpu) != RISCV_HWPROBE_MISALIGNED_VECTOR_UNKNOWN) return 0; check_vector_unaligned_access_emulated(NULL); check_vector_unaligned_access(NULL); - return 0; -} - -/* Measure unaligned access speed on all CPUs present at boot in parallel. */ -static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __always_unused) -{ - schedule_on_each_cpu(check_vector_unaligned_access); +#endif return 0; } -#else /* CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS */ -static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __always_unused) -{ - return 0; -} -#endif static int __init check_unaligned_access_all_cpus(void) { @@ -409,10 +412,8 @@ static int __init check_unaligned_access_all_cpus(void) cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "riscv:online", riscv_online_cpu, riscv_offline_cpu); #endif -#ifdef CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "riscv:online", riscv_online_cpu_vec, NULL); -#endif return 0; } From patchwork Fri Feb 21 14:57:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 13985647 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 58772C021B5 for ; Fri, 21 Feb 2025 14:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BvMqT/VbJnN99sFZ3CUeWXm3MqYksZDyGFTp6MPFXas=; b=BqnLn+d2dVdTm7 otNl2PExmHWhwNEILrO4LqNjlxOZiSUjQgZ1umTXZ6Ncxuc/ZCciW2dgTsgxZkOqdH5kt0dBB4UMB PaZ4iX8vnFxdze+CCBX+eCgv7fpRgM8qhpZKEHvee/O8IJHo073bP/pzCss2f4Hbu9aDbHVWayPNa bRC9kxDxd3q8V3h7F5ZKMutNxM9hlwf8lec1/jA4PHILdmeA1jjNjSY0/Z9c5dXgJef2gHuHUcrKY vTnikikmj5A1fhhQwrBrb9G+dcocWBlnr6Fv5mZzYy6DDhxzMHbzM+NQL/KCF2M89CcGPqR5fUqyD Xommp8fNWql1QjTzsbNA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tlUT9-00000005tz1-0Qys; Fri, 21 Feb 2025 14:57:35 +0000 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tlUT4-00000005tv3-2dFP for linux-riscv@lists.infradead.org; Fri, 21 Feb 2025 14:57:31 +0000 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-4393dc02b78so15364275e9.3 for ; Fri, 21 Feb 2025 06:57:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1740149849; x=1740754649; darn=lists.infradead.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; bh=Gn5/NCGaSe0l3cHfov0pCSQdo/p0YZ9zobfu9KR9U04=; b=IAmZ8aJGYixSmZcTrAozrt+WFJURmfNVGTvEOnLvjDAK4awdqfbFnnbBq47Lji3U+Z lwpZTyK0LhlfwtFNUddDuSDJzGzf/WHeXLQHCbenAdQLubH+jMYB/Ant6XbROFksZmfg wlbLgqka00ZyqcOnv65DPMaTVSaPzB+ZBbA38kW5mA4jEfLar6XIEB4phjK9ZYP3pvVz rKjO1qMEwVv/C/NYNJqy4H24PeBCDSn9x9QidCXYmpIk4gKmcI2Q5lXbqCfBBqN95thx xaxoMSVZTUGEJEPiINlZ9whaKClRJa+ou/4z7WNmJiOlKfxgSJRgwqo1/DlUQVsKKFeu OOXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740149849; x=1740754649; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Gn5/NCGaSe0l3cHfov0pCSQdo/p0YZ9zobfu9KR9U04=; b=Y+m4TOVIASaNsqkud1UkjvqLEuLilLUrY1VvknG0ado536qqyEamzatnZoaKZz9abj F55gR0W4TSJGmaPWlF4oiHcBQ6JI6cmq3wGCjYVhXgkw4c7Tm7kJew0uC+jqPeTQF1Zu 0lAwykIjP0K1igt7QabUMWhqMobm+Da90UAMv375NekRaYdqT1Xwk/6EmlCAYxgS6xfr ltUwSW1JixJZcv/A/R0MBa3poK6eJLGIMjeKExkldVuh51eutY6HrDBOKgxYfDP6qOvS +1yKmc7MiO3cupV0lqsGT1KZFERQ8WviqrxH+x84+5zTGy4VTvtkYg7aXDpOFsSw4+ZB e6Kg== X-Gm-Message-State: AOJu0YzplBIXb9cOSdyPVFJnRpaJ3b/XFTO+2gXLB5xTEvfBd2TFW48w 88ooTL0g+87jjeplFb6IC+ZLnGc3MNrrAx6hAdK9sT3LSIP1DPFkKkOLq/kx5PfDQYXfd9MVIOZ 2 X-Gm-Gg: ASbGncud9TRP2OC2Q9wxvxGQxzNU/m4MJey0C+E5xZt+sN2fPoaGRFp8b2urERGyr25 WQ6U/y/Od1InVoGQF5AFwHONgLsJM2HHb8vlc2m9Ty/vADsQsZ/Z9YQ44Z7GuSwcjPEyhVuDjfj 6Zjbn14m34RQQ9qqnpWxsVUouNPsTBxq/5aVzfUyleZ/jyfmwJzFTXT0HLVptic0H0c1QOOwyOU BNY3J0IRFnBjjIvjebTheCE8tGgOTy4pLGBdIT+OMLjA3a4gCk1zIW4L84Vz0KIOCyiPSo9MtoC 1j4MjS044HNSRg== X-Google-Smtp-Source: AGHT+IHx/xR0hU26C0luF7JCqRur1mrlX3ev+Org0F1aBDScnbAW8fdMK9SKCnjI9IEZG4FO1cj34Q== X-Received: by 2002:a5d:64af:0:b0:38f:452f:9f89 with SMTP id ffacd0b85a97d-38f6f0ae2c4mr3479590f8f.50.1740149849237; Fri, 21 Feb 2025 06:57:29 -0800 (PST) Received: from localhost ([2a02:8308:a00c:e200::766e]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38f258b4423sm23984504f8f.11.2025.02.21.06.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2025 06:57:28 -0800 (PST) From: Andrew Jones To: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, charlie@rivosinc.com, cleger@rivosinc.com, alex@ghiti.fr, Anup Patel , corbet@lwn.net Subject: [PATCH v2 7/8] riscv: Add parameter for skipping access speed tests Date: Fri, 21 Feb 2025 15:57:26 +0100 Message-ID: <20250221145718.115076-17-ajones@ventanamicro.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250221145718.115076-10-ajones@ventanamicro.com> References: <20250221145718.115076-10-ajones@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250221_065730_699123_FFF21BDD X-CRM114-Status: GOOD ( 19.59 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Allow skipping scalar and vector unaligned access speed tests. This is useful for testing alternative code paths and to skip the tests in environments where they run too slowly. All CPUs must have the same unaligned access speed. The code movement is because we now need the scalar cpu hotplug callback to always run, so we need to bring it and its supporting functions out of CONFIG_RISCV_PROBE_UNALIGNED_ACCESS. Signed-off-by: Andrew Jones --- arch/riscv/kernel/unaligned_access_speed.c | 162 ++++++++++++++------- 1 file changed, 107 insertions(+), 55 deletions(-) diff --git a/arch/riscv/kernel/unaligned_access_speed.c b/arch/riscv/kernel/unaligned_access_speed.c index d9d4ca1fadc7..241d47004f37 100644 --- a/arch/riscv/kernel/unaligned_access_speed.c +++ b/arch/riscv/kernel/unaligned_access_speed.c @@ -24,6 +24,9 @@ DEFINE_PER_CPU(long, misaligned_access_speed) = RISCV_HWPROBE_MISALIGNED_SCALAR_UNKNOWN; DEFINE_PER_CPU(long, vector_misaligned_access) = RISCV_HWPROBE_MISALIGNED_VECTOR_UNSUPPORTED; +static long unaligned_scalar_speed_param = RISCV_HWPROBE_MISALIGNED_SCALAR_UNKNOWN; +static long unaligned_vector_speed_param = RISCV_HWPROBE_MISALIGNED_VECTOR_UNKNOWN; + #ifdef CONFIG_RISCV_PROBE_UNALIGNED_ACCESS static cpumask_t fast_misaligned_access; static int check_unaligned_access(void *param) @@ -130,6 +133,50 @@ static void __init check_unaligned_access_nonboot_cpu(void *param) check_unaligned_access(pages[cpu]); } +/* Measure unaligned access speed on all CPUs present at boot in parallel. */ +static void __init check_unaligned_access_speed_all_cpus(void) +{ + unsigned int cpu; + unsigned int cpu_count = num_possible_cpus(); + struct page **bufs = kcalloc(cpu_count, sizeof(*bufs), GFP_KERNEL); + + if (!bufs) { + pr_warn("Allocation failure, not measuring misaligned performance\n"); + return; + } + + /* + * Allocate separate buffers for each CPU so there's no fighting over + * cache lines. + */ + for_each_cpu(cpu, cpu_online_mask) { + bufs[cpu] = alloc_pages(GFP_KERNEL, MISALIGNED_BUFFER_ORDER); + if (!bufs[cpu]) { + pr_warn("Allocation failure, not measuring misaligned performance\n"); + goto out; + } + } + + /* Check everybody except 0, who stays behind to tend jiffies. */ + on_each_cpu(check_unaligned_access_nonboot_cpu, bufs, 1); + + /* Check core 0. */ + smp_call_on_cpu(0, check_unaligned_access, bufs[0], true); + +out: + for_each_cpu(cpu, cpu_online_mask) { + if (bufs[cpu]) + __free_pages(bufs[cpu], MISALIGNED_BUFFER_ORDER); + } + + kfree(bufs); +} +#else /* CONFIG_RISCV_PROBE_UNALIGNED_ACCESS */ +static void __init check_unaligned_access_speed_all_cpus(void) +{ +} +#endif + DEFINE_STATIC_KEY_FALSE(fast_unaligned_access_speed_key); static void modify_unaligned_access_branches(cpumask_t *mask, int weight) @@ -191,9 +238,14 @@ static int riscv_online_cpu(unsigned int cpu) static struct page *buf; /* We are already set since the last check */ - if (per_cpu(misaligned_access_speed, cpu) != RISCV_HWPROBE_MISALIGNED_SCALAR_UNKNOWN) + if (per_cpu(misaligned_access_speed, cpu) != RISCV_HWPROBE_MISALIGNED_SCALAR_UNKNOWN) { goto exit; + } else if (unaligned_scalar_speed_param != RISCV_HWPROBE_MISALIGNED_SCALAR_UNKNOWN) { + per_cpu(misaligned_access_speed, cpu) = unaligned_scalar_speed_param; + goto exit; + } +#ifdef CONFIG_RISCV_PROBE_UNALIGNED_ACCESS check_unaligned_access_emulated(NULL); buf = alloc_pages(GFP_KERNEL, MISALIGNED_BUFFER_ORDER); if (!buf) { @@ -203,6 +255,7 @@ static int riscv_online_cpu(unsigned int cpu) check_unaligned_access(buf); __free_pages(buf, MISALIGNED_BUFFER_ORDER); +#endif exit: set_unaligned_access_static_branches(); @@ -217,50 +270,6 @@ static int riscv_offline_cpu(unsigned int cpu) return 0; } -/* Measure unaligned access speed on all CPUs present at boot in parallel. */ -static void __init check_unaligned_access_speed_all_cpus(void) -{ - unsigned int cpu; - unsigned int cpu_count = num_possible_cpus(); - struct page **bufs = kcalloc(cpu_count, sizeof(*bufs), GFP_KERNEL); - - if (!bufs) { - pr_warn("Allocation failure, not measuring misaligned performance\n"); - return; - } - - /* - * Allocate separate buffers for each CPU so there's no fighting over - * cache lines. - */ - for_each_cpu(cpu, cpu_online_mask) { - bufs[cpu] = alloc_pages(GFP_KERNEL, MISALIGNED_BUFFER_ORDER); - if (!bufs[cpu]) { - pr_warn("Allocation failure, not measuring misaligned performance\n"); - goto out; - } - } - - /* Check everybody except 0, who stays behind to tend jiffies. */ - on_each_cpu(check_unaligned_access_nonboot_cpu, bufs, 1); - - /* Check core 0. */ - smp_call_on_cpu(0, check_unaligned_access, bufs[0], true); - -out: - for_each_cpu(cpu, cpu_online_mask) { - if (bufs[cpu]) - __free_pages(bufs[cpu], MISALIGNED_BUFFER_ORDER); - } - - kfree(bufs); -} -#else /* CONFIG_RISCV_PROBE_UNALIGNED_ACCESS */ -static void __init check_unaligned_access_speed_all_cpus(void) -{ -} -#endif - #ifdef CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS static void check_vector_unaligned_access(struct work_struct *work __always_unused) { @@ -372,8 +381,8 @@ static int __init vec_check_unaligned_access_speed_all_cpus(void *unused __alway static int riscv_online_cpu_vec(unsigned int cpu) { - if (!has_vector()) { - per_cpu(vector_misaligned_access, cpu) = RISCV_HWPROBE_MISALIGNED_VECTOR_UNSUPPORTED; + if (unaligned_vector_speed_param != RISCV_HWPROBE_MISALIGNED_VECTOR_UNKNOWN) { + per_cpu(vector_misaligned_access, cpu) = unaligned_vector_speed_param; return 0; } @@ -388,30 +397,73 @@ static int riscv_online_cpu_vec(unsigned int cpu) return 0; } +static const char * const speed_str[] __initconst = { NULL, NULL, "slow", "fast", "unsupported" }; + +static int __init set_unaligned_scalar_speed_param(char *str) +{ + if (!strcmp(str, speed_str[RISCV_HWPROBE_MISALIGNED_SCALAR_SLOW])) + unaligned_scalar_speed_param = RISCV_HWPROBE_MISALIGNED_SCALAR_SLOW; + else if (!strcmp(str, speed_str[RISCV_HWPROBE_MISALIGNED_SCALAR_FAST])) + unaligned_scalar_speed_param = RISCV_HWPROBE_MISALIGNED_SCALAR_FAST; + else if (!strcmp(str, speed_str[RISCV_HWPROBE_MISALIGNED_SCALAR_UNSUPPORTED])) + unaligned_scalar_speed_param = RISCV_HWPROBE_MISALIGNED_SCALAR_UNSUPPORTED; + else + return -EINVAL; + + return 1; +} +__setup("unaligned_scalar_speed=", set_unaligned_scalar_speed_param); + +static int __init set_unaligned_vector_speed_param(char *str) +{ + if (!strcmp(str, speed_str[RISCV_HWPROBE_MISALIGNED_VECTOR_SLOW])) + unaligned_vector_speed_param = RISCV_HWPROBE_MISALIGNED_VECTOR_SLOW; + else if (!strcmp(str, speed_str[RISCV_HWPROBE_MISALIGNED_VECTOR_FAST])) + unaligned_vector_speed_param = RISCV_HWPROBE_MISALIGNED_VECTOR_FAST; + else if (!strcmp(str, speed_str[RISCV_HWPROBE_MISALIGNED_VECTOR_UNSUPPORTED])) + unaligned_vector_speed_param = RISCV_HWPROBE_MISALIGNED_VECTOR_UNSUPPORTED; + else + return -EINVAL; + + return 1; +} +__setup("unaligned_vector_speed=", set_unaligned_vector_speed_param); + static int __init check_unaligned_access_all_cpus(void) { int cpu; - if (!check_unaligned_access_emulated_all_cpus()) + if (unaligned_scalar_speed_param == RISCV_HWPROBE_MISALIGNED_SCALAR_UNKNOWN && + !check_unaligned_access_emulated_all_cpus()) { check_unaligned_access_speed_all_cpus(); - - if (!has_vector()) { + } else { + pr_info("scalar unaligned access speed set to '%s' by command line\n", + speed_str[unaligned_scalar_speed_param]); for_each_online_cpu(cpu) - per_cpu(vector_misaligned_access, cpu) = RISCV_HWPROBE_MISALIGNED_VECTOR_UNSUPPORTED; - } else if (!check_vector_unaligned_access_emulated_all_cpus() && - IS_ENABLED(CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS)) { + per_cpu(misaligned_access_speed, cpu) = unaligned_scalar_speed_param; + } + + if (!has_vector()) + unaligned_vector_speed_param = RISCV_HWPROBE_MISALIGNED_VECTOR_UNSUPPORTED; + + if (unaligned_vector_speed_param == RISCV_HWPROBE_MISALIGNED_VECTOR_UNKNOWN && + !check_vector_unaligned_access_emulated_all_cpus() && + IS_ENABLED(CONFIG_RISCV_PROBE_VECTOR_UNALIGNED_ACCESS)) { kthread_run(vec_check_unaligned_access_speed_all_cpus, NULL, "vec_check_unaligned_access_speed_all_cpus"); + } else { + pr_info("vector unaligned access speed set to '%s' by command line\n", + speed_str[unaligned_vector_speed_param]); + for_each_online_cpu(cpu) + per_cpu(vector_misaligned_access, cpu) = unaligned_vector_speed_param; } /* * Setup hotplug callbacks for any new CPUs that come online or go * offline. */ -#ifdef CONFIG_RISCV_PROBE_UNALIGNED_ACCESS cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "riscv:online", riscv_online_cpu, riscv_offline_cpu); -#endif cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN, "riscv:online", riscv_online_cpu_vec, NULL); From patchwork Fri Feb 21 14:57:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 13985650 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 813D5C021B8 for ; Fri, 21 Feb 2025 14:57:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hpVytkROoQ8KLEo5D8s+IvnezSvzbcCbkVQipzKtc1E=; b=1nIaig6+3yrtRv lVrftD/xU34ZU0AjIN15G72iICfg0G2EjW6pULEoiTxbh7+oR1aY9d6Fzc4mRlRlZH1i2bVfc9yJ7 g1X2z8rXCeUDAJWUoiIz5NsWqvYNNZfVT8FuGvpe6rfOKM2jLlg3ZHAJjkIvOWo00W/KYXsw3buvh JDDgJSj//7R1yv8DqaB4PlEitD64eGCVWkIafxwBFYTISjsGk3teBaKO6c7F96fd8dJgJVQFjpNV/ XYVfI2z3oRyceYh845gIB7jm7MqTRRZsoWBUosV62ti2xhXqAWKEb3UG1wsuTqExgXaxw//dawKBK 0jMQZ8FBZgv4vR6nmelA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tlUTB-00000005u0z-32CH; Fri, 21 Feb 2025 14:57:37 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1tlUT6-00000005twg-2VAQ for linux-riscv@lists.infradead.org; Fri, 21 Feb 2025 14:57:33 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-388cae9eb9fso1145426f8f.3 for ; Fri, 21 Feb 2025 06:57:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; t=1740149851; x=1740754651; darn=lists.infradead.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; bh=KvHP2BboCGauKM0TvBqQfBu7j1TlN9OaRIMMc+Vl6gA=; b=Kiy9KWC3DSHTr9BmhC0B22Rsx3KhjmlFCwc5cicHFWVIe9v3rrHu/o83dYWEzdrCJa f8cLVSuDYowmEMWlbYgzHSQPe8WITRXs8CPrRsYRap6vMRGbJcuDSuoBLDcVFrz0dVTK bl4hJ3qqBETZ84xfezI54Hy0IGqykGoYVnPQ4oX1Er65PkqKcX7U2HvXApNiuuRKE6mY mClqclajEy/y1V+6ap9WglqSdf9bjb+89DrDJSgNZdNLzVGcHrISHvwulIB9GDywdW69 F9O1h/zW5ilcGu8ErknJ8HvdFMG4T0U+EcJdVIJ6D9bV+fZQf5aVLW33sEc+y2pe0CMX qSTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740149851; x=1740754651; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KvHP2BboCGauKM0TvBqQfBu7j1TlN9OaRIMMc+Vl6gA=; b=EJUdhNz7RO3V+XlIJ+9WeLDGS1j78Aen7s1SHts2dVuPjyuBlQMH7LXke5cl3TcoGp mQMARHIpzXeNiyMUvVXMnq0vvnYfTnS6A5BuvqYW/Xk5DJ/utXYfrnDe1NrkyoKSVCnM w3kp6LsMCSV9JZBwmGDL05T/L1fSxInA5pKZ0R3iqsiaq3o8O4v4C/M9C1KOv+w1Oflr oq8XjFNYTVYdsm0aKK5RB7HgjO6BtBiEn9n/8qa+yv7hnpq/4WLDxaOclEakLkG/MDp5 zW4M9xWrSmgNMRGnhZxl9zRQVrttzpC6JCkuh5mMnsZ8QtnuTF5vGNbOHpSuI6P5k4hQ VJcA== X-Gm-Message-State: AOJu0Yy27+dio5fTjDXbql9bM15ofv4SHExryf+ZSs0Jjm/I+18z/pOx gDAD2v5kiKTosiSzc6aOckA+8F28uKJDojUy1sqQIccn5a3u3quQDew0vcjC/ryd9frARbYJL4u / X-Gm-Gg: ASbGnctJLGniIXEjg+fiV5GAO1QdNVjrYdmoYv/gKbPyDApISyDZISLTqsBDqXKHXEi EyM+aJDfn52328R590B9UJnF3xOHA2W6KQ3PQ5kUhCwjZbpJK2rbvt/2Ok0mDSVrzlNjn1aMmtm bEhes460gRgXqm2g+VP0in7fxFX0vTmaxxjJv0MdA6TfWLLx3SHZCo7R0nj47nwrhd7T5lU/+JB DVJoBKz2Ay+OHPk80j86wgFTX1kOyrIeAkNlSMhZ0yLOo5t0YU8tW8yeeXHtHIZbdPMKR0wl+fg yB3GcgaJAUhNcA== X-Google-Smtp-Source: AGHT+IHcoDd+Wx7yCfHbXvCGdFs5uIccGxXcfrSZqLhmSwNHn36B0PnuR7cIJZPeqdU6yBBLobUiMA== X-Received: by 2002:a05:6000:1a8c:b0:38f:2113:fba0 with SMTP id ffacd0b85a97d-38f6f0c3acfmr3393343f8f.50.1740149850872; Fri, 21 Feb 2025 06:57:30 -0800 (PST) Received: from localhost ([2a02:8308:a00c:e200::766e]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-439b02d6974sm19479585e9.14.2025.02.21.06.57.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Feb 2025 06:57:30 -0800 (PST) From: Andrew Jones To: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, charlie@rivosinc.com, cleger@rivosinc.com, alex@ghiti.fr, Anup Patel , corbet@lwn.net Subject: [PATCH v2 8/8] Documentation/kernel-parameters: Add riscv unaligned speed parameters Date: Fri, 21 Feb 2025 15:57:27 +0100 Message-ID: <20250221145718.115076-18-ajones@ventanamicro.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250221145718.115076-10-ajones@ventanamicro.com> References: <20250221145718.115076-10-ajones@ventanamicro.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250221_065732_632630_1641FA02 X-CRM114-Status: UNSURE ( 8.31 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Document riscv parameters used to select scalar and vector unaligned access speeds. Signed-off-by: Andrew Jones --- Documentation/admin-guide/kernel-parameters.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index fb8752b42ec8..9e3c5fecfa52 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -7477,6 +7477,22 @@ Note that genuine overcurrent events won't be reported either. + unaligned_scalar_speed= + [RISCV] + Format: {slow | fast | unsupported} + Allow skipping scalar unaligned access speed tests. This + is useful for testing alternative code paths and to skip + the tests in environments where they run too slowly. All + CPUs must have the same scalar unaligned access speed. + + unaligned_vector_speed= + [RISCV] + Format: {slow | fast | unsupported} + Allow skipping vector unaligned access speed tests. This + is useful for testing alternative code paths and to skip + the tests in environments where they run too slowly. All + CPUs must have the same vector unaligned access speed. + unknown_nmi_panic [X86] Cause panic on unknown NMI.