Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp1133754rdb; Fri, 2 Feb 2024 15:13:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IEiWq+GnpcR9a4uVWYgpeBSCyayJaKQ8M3d5NvkcdXREgy6d2px03MQWg0S42OvGiSYVL+A X-Received: by 2002:a05:690c:808:b0:5fb:9715:eaaf with SMTP id bx8-20020a05690c080800b005fb9715eaafmr7145407ywb.33.1706915624017; Fri, 02 Feb 2024 15:13:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706915624; cv=pass; d=google.com; s=arc-20160816; b=FhxJeyjXc+Qn++elFY++Ipa4jdG/Yb4z/3L7oece9pDcIpVCHXD/UtlXFRGFoaNxRF KVu72WEdcGTyHmw8GmnqYP9HPVdb2HcA3zgcciE5MumXewj8+ciWJ0YZ/E3woV+K7St4 LCPyoD4Y8aA7nVi/GFzFmPcpmOqj33m4i35PzrYTk3v8oRPPgtJ3coJD2KLHECqSfsFG aJhsP528ActyJTQzXYKFTS1Ky0pX4tp05gWaJM1N+uW/AjaD41S1+BrEd2eGC8zlfPSS V5I8oNjUbJrqmLrPLDpy1B086/24BTfop1XFCkzGdlS7AbK7ZcaV9EH/8QwESp5/lnAo psAQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2TsmrtpZilFHjgl5uRHHuRHDPg55n9buxc3ptU+YVsk=; fh=DcbSNP94qLugrQryX+mZ80sBTp/rrhT6AlosDH+jrwI=; b=MYgPEcUelEYb2bBA9K9zlPuY15vxUtbDCSgz1E5khJPbKvRjKWx76s5Vywv295fU8P COftsbkEYbQJ1Qv0NqYiUvpOoRLFecRV8RbBf3FnxDhowJARnnrf5pVSL9TWXQVMTEIz BkxFnJahDAzO7JiODLiVzNdtKIggn4++4mVyPw3YXZAMj4Z8F5iEKw699KJ4yFcEjDfR CShWT9Vu7WM9svpb062xyLtqwheiJQRMh2gq4cXWJCBAURPzzLPsWz50zYuuxYAXbs2P 8aPkEUZNKyof2eM/sFYQvQ5/SxGBqWYC7aeTwp2YiX0tLLtagcsn3n91mnvsoGwh4PTZ l1XQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=X65pWUkI; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-50703-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50703-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCWm3bUd1O99CUrNVwrEVDjZFtCmKw2Koznuz4PV3+igh0dnAfZZ/CrRlXo+Mmgfr3XAO3U5gh1V8pPvert6K6OGya8nYzaJU6OWdYybcw== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id w3-20020a05620a0e8300b00783c923b0afsi2901185qkm.585.2024.02.02.15.13.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 15:13:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-50703-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@rivosinc-com.20230601.gappssmtp.com header.s=20230601 header.b=X65pWUkI; arc=pass (i=1 spf=pass spfdomain=rivosinc.com dkim=pass dkdomain=rivosinc-com.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-50703-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-50703-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id B118D1C21049 for ; Fri, 2 Feb 2024 23:13:43 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6503A12C7E5; Fri, 2 Feb 2024 23:13:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b="X65pWUkI" Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 13A6063103 for ; Fri, 2 Feb 2024 23:13:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706915616; cv=none; b=l8TCJY99OkVQxdIiAxWwt9KgtekytZ0vFs4r5mm+NCDMG3ZJn7a2NXn/Idvy/izZAi9UVv4lZ2CfcyDenXNk33WIzof4AVBGg6DTB2vRJTjTGmOej7edkrVIKAAauTqlx3WnejgYeYm7tBDSfxZsMKxaM2c4S6NOAk+h9qjSTj0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706915616; c=relaxed/simple; bh=zl4j+AaEv8Vgs1eQrhwVDTcs4FxjXQxfIHhHX8agKqw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=b8X6M8CYwY3CDeISOEv32j466OWWE+BznJAepIpehdHNQqPElf5EQuRO0auI+Za2iyPL5bck3dXgGqsMlO0akEOOtnTIKDz7HqiGvxyFW9va9it6i6JqX8EwcGYoFLTD3Gq0aqfRMpDsx4lJM9CWoE78c1ZN4Krw5Q6uGUh3VrU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com; spf=pass smtp.mailfrom=rivosinc.com; dkim=pass (2048-bit key) header.d=rivosinc-com.20230601.gappssmtp.com header.i=@rivosinc-com.20230601.gappssmtp.com header.b=X65pWUkI; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=rivosinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rivosinc.com Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1d7393de183so20326365ad.3 for ; Fri, 02 Feb 2024 15:13:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rivosinc-com.20230601.gappssmtp.com; s=20230601; t=1706915614; x=1707520414; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=2TsmrtpZilFHjgl5uRHHuRHDPg55n9buxc3ptU+YVsk=; b=X65pWUkIjznyAm0d3cq4JzqxJaXDcmNk0Nz3cVVLEuGP6bMz6mQSttmaMgYomBQbxl OD6P8WzbvQVbJTyMs15rjLTNB35lbtKvre+yD556Pu++WU0DY7McqAT69ujiTYpxMKfC 8RmpqETitVREvCzPA85OP+TniTjsZoRMwsTsXRBFzM8RwAFDZVeOwCCbMtoPed5hzOJ4 g6iyod8gvGCHL4F/yI/akOohGV6tv/CdBlgm/kV7yCJjSFsrHbR4HnaKqaz1sTecj1pA gf6op5YmcqsQDdrOpH2yFW/viRiHOh9kD50M0rhPQbBIFLETOiDpgdrygfr2VtgJ7lSe ih+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706915614; x=1707520414; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=2TsmrtpZilFHjgl5uRHHuRHDPg55n9buxc3ptU+YVsk=; b=RhM7li1iKY1Ft3pmVDVIUikSR3ZKW2N1mYEpOy+XlNFcdPbFq83aEbmLxoL4R0p6FH kT0lc308uueDEVGmYkHeJkUKk3teyRJQcdWxsgEiywNyuzbK1TLqbdLgrTotXS7n6bgX itgypGwDkyfYkmnFEfpz+mhG92dPxaPZPah9zg2LkYzitnbryALEzp13+jmSKXjVUSyV fFPzpzAuwb+GtLplXBLHWmx4dvCQPNHS90/Ipi2Y1EzJyHvUIrDdx33gK+aaICb0BVMg uRZdDg3CnoaR/lzAoxITX6ohVyYuj6wLmUfMod1/nMGESFNEAc9Pyygvwii8PEfpeiU/ t4JQ== X-Gm-Message-State: AOJu0YxcUff9owWF4zgG67Bv7w+guoXfNqAlw5iNSnZO8v6jLAclAo5U a/Q5EEFF2Y9etUo+M2ypusthDYodtGVxhJn1lpdm26/XufoYurNs82zev0JnLag= X-Received: by 2002:a17:903:248:b0:1d9:657c:2769 with SMTP id j8-20020a170903024800b001d9657c2769mr5780377plh.19.1706915614379; Fri, 02 Feb 2024 15:13:34 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCU+SGgqwEfx19PBs8fHvAMKLSdqMYN36KZd3TpRH+cEFO4JT9WvVgr1NS9UwGhtPQRRDToWcP66E+L9gqzeNj3KoooChAVA/doSfKB1LmUp9aSZkRa0yeWvwmQEiHMpjOxQnWzZnzLV0ehGjfsGmN3us7dxEtEZaRiUyqcsBTjQUoBjfocy2+YmjPRPrEuBtrU7D87vVFr+36JhiI93fkl5m4PRrkRWFoD9r4GTg9AZze5L3YyvoHZbw8JHa59g3lDkbuf470vKVEk0dUpkuaFx+XtWtg== Received: from ghost ([12.44.203.122]) by smtp.gmail.com with ESMTPSA id d5-20020a170902ef0500b001d8ee46170dsm2139216plx.84.2024.02.02.15.13.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 15:13:33 -0800 (PST) Date: Fri, 2 Feb 2024 15:13:31 -0800 From: Charlie Jenkins To: Eric Biggers Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Jisheng Zhang , Evan Green , =?iso-8859-1?Q?Cl=E9ment_L=E9ger?= , linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] riscv: Disable misaligned access probe when CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS Message-ID: References: <20240201-disable_misaligned_probe_config-v2-0-77c368bed7b2@rivosinc.com> <20240201-disable_misaligned_probe_config-v2-2-77c368bed7b2@rivosinc.com> <20240202230101.GB2055@sol.localdomain> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240202230101.GB2055@sol.localdomain> On Fri, Feb 02, 2024 at 03:01:01PM -0800, Eric Biggers wrote: > On Thu, Feb 01, 2024 at 03:30:46PM -0800, Charlie Jenkins wrote: > > diff --git a/arch/riscv/include/asm/cpufeature.h b/arch/riscv/include/asm/cpufeature.h > > index eb3ac304fc42..3a29d8e30e05 100644 > > --- a/arch/riscv/include/asm/cpufeature.h > > +++ b/arch/riscv/include/asm/cpufeature.h > > @@ -51,6 +51,7 @@ static inline bool check_unaligned_access_emulated(int cpu) > > static inline void unaligned_emulation_finish(void) {} > > #endif > > > > +#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS > > #ifdef..#else..#endif is more readable than #ifndef..#else..#endif. > > > diff --git a/arch/riscv/include/asm/misaligned_access_speed.h b/arch/riscv/include/asm/misaligned_access_speed.h > > new file mode 100644 > > index 000000000000..81df2aa6fa6b > > --- /dev/null > > +++ b/arch/riscv/include/asm/misaligned_access_speed.h > > This new header file isn't included from anywhere. > I thought I deleted that... > > diff --git a/arch/riscv/kernel/Makefile b/arch/riscv/kernel/Makefile > > index f71910718053..8be7f17da9ab 100644 > > --- a/arch/riscv/kernel/Makefile > > +++ b/arch/riscv/kernel/Makefile > > @@ -62,6 +62,9 @@ obj-y += tests/ > > obj-$(CONFIG_MMU) += vdso.o vdso/ > > > > obj-$(CONFIG_RISCV_MISALIGNED) += traps_misaligned.o > > +ifneq ($(RISCV_EFFICIENT_UNALIGNED_ACCESS), y) > > +obj-y += misaligned_access_speed.o > > +endif > > CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS > > > diff --git a/arch/riscv/kernel/sys_hwprobe.c b/arch/riscv/kernel/sys_hwprobe.c > > index a7c56b41efd2..3f1a6edfdb08 100644 > > --- a/arch/riscv/kernel/sys_hwprobe.c > > +++ b/arch/riscv/kernel/sys_hwprobe.c > > @@ -149,6 +149,7 @@ static bool hwprobe_ext0_has(const struct cpumask *cpus, unsigned long ext) > > > > static u64 hwprobe_misaligned(const struct cpumask *cpus) > > { > > +#ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS > > int cpu; > > u64 perf = -1ULL; > > > > @@ -168,6 +169,9 @@ static u64 hwprobe_misaligned(const struct cpumask *cpus) > > return RISCV_HWPROBE_MISALIGNED_UNKNOWN; > > > > return perf; > > +#else > > + return RISCV_HWPROBE_MISALIGNED_FAST; > > +#endif > > #ifdef..#else..#endif is more readable than #ifndef..#else..#endif. > > - Eric Thanks for pointing these out, I will send a v3. - Charlie