Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp157397lqh; Thu, 30 May 2024 18:17:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWDFPaqzpQE1oiHKlm55FeRpdcgCWCbgrDpHiTRevIJqL2l/PxdfDngRk1gVLbxsDu1A5HlaVBeddQk3QQRN9+FyfrCbEVOMzcaJn7mBg== X-Google-Smtp-Source: AGHT+IHkT0GA195/Jkor/CAk8P95A74VwSaFskJ/243WcLh6fWDAUTR2aJGDQPGEqFJSha5i/dDF X-Received: by 2002:a17:906:fb9b:b0:a5c:dad0:c464 with SMTP id a640c23a62f3a-a65f0910cd5mr298607566b.6.1717118257248; Thu, 30 May 2024 18:17:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717118257; cv=pass; d=google.com; s=arc-20160816; b=h3H14dhfa5HH2GObSvZiB5Bs42uFVPZT0kTuVComvTQ2a9vtBikhPJU+Av++pLPIIJ 0ahCMfGAezfEDBl6UPbP0ModV6O2VE3MFH5LlssSxC5eiFkCGS4iGEPzjXizTIJkPAmt fthSGQuSTOfg6JKYCXkjbXLI12icfnp+aLvFjDiexeEgmzn+HXMPD+9vAtcxs3AnP+JM sSo3mqwFXINtRVYqZ4vesonveR6C7T2V8tWqQ8C1PzcGiOngyOKNccf5PCfd9tNI7zee 64tpdmQKBdG1vHmBXvnSc3U0ljzSl0tz15KSBwSz3AinEedGbfQYrUlW2ruvgDCEIPAR qhrA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=wwENAVxxQtEomtor8VVQD99hPDXcx9AWwuArFugb+7Q=; fh=jO1y9PVoRfqgAoWuYtezoYi4/poQfGrXov1lUwSGF5M=; b=Te19c5RjnlS89fPi4jXoYwfsbi7g10rOkuX2asLBy1Os6Lt4Rg75v/Bs0qN7kWk2vw 6+i/nGzUX72w/Gb84hX4HANv6SUyEpw//jseK4uxAY1eIAgDfQt0QHpK8BCRW8Gf/kYq QIR+HIJF/z+6ukKQg95STOxxg9+cBVyVrCZGNBdOwBM4zYYE/FE4ZzyIWYNFYaUHDWaS ycaQ8eM/7QsiJxBmMss0VXcT79sy5lhnC4TxgONy/pVo9yhGrCc2I3up7TI+49dlHqsm M98Vo2WTfOgOjhJ6XpAfKZhxGVh6RosQaZ/I8QedIOJt2s48xuteNTtI/uATG2+7tPR1 IXfg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=qYcThanK; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-196127-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196127-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a67eb7235d0si31921466b.998.2024.05.30.18.17.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 May 2024 18:17:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-196127-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=qYcThanK; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-196127-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-196127-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 am.mirrors.kernel.org (Postfix) with ESMTPS id F2E1E1F23F14 for ; Fri, 31 May 2024 01:17:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 839606FB8; Fri, 31 May 2024 01:17:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="qYcThanK" Received: from out-187.mta1.migadu.com (out-187.mta1.migadu.com [95.215.58.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9E7D56AC0 for ; Fri, 31 May 2024 01:17:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717118250; cv=none; b=bvHZ5+jy/kEW+WST8b0af3oNhRRuzcBxla9H3g+qrLiJENIKlE9Olyqe0S9FJarYXqk1c8SKTvt58hsCwF1OcOw6xkzvkNp6E4h/BwIAnofhHOTrdJEUXgxMWd3xc/q0iFGslEf+cOiKBpNVXHi4xcjApYuyQXgnnEmlu/JVWfY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717118250; c=relaxed/simple; bh=6qmwuyMEvvP0Hsm2Rz0a7pueEgM5xbu7B+w3vkN7rYk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=p5VNbezIyYYQiWpPb2sunQ5NcCFwixir09kXeAirsM0QdYwjd0FePwU4QrKYAFA0u2E1IRk4NyhsUjZGNHOut6KATL3qD641j7wjx0NMK9aukgmBKpJho3Gbhye5dgomamy7kOOqQg79BAuUUmoz7XZuVquzSWx0pB/4UeF8GT4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=qYcThanK; arc=none smtp.client-ip=95.215.58.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Envelope-To: nik.borisov@suse.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1717118244; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=wwENAVxxQtEomtor8VVQD99hPDXcx9AWwuArFugb+7Q=; b=qYcThanKKIBCctUoEHBCXOtSOk9m3a4y4iTXSLJ3BTaV34TPXSNNftXp2BjVpI5rvYAkNg aaHvSU7eZSlE0FjdEIn34NTDhevkwN3IG0AdOazV6x+C/1/7N6DsiJgsIxxmM4yw7K9sKx KOM3N0FfqJ5jPZKpmfl903LX0JGcmHQ= X-Envelope-To: tglx@linutronix.de X-Envelope-To: mingo@redhat.com X-Envelope-To: bp@alien8.de X-Envelope-To: dave.hansen@linux.intel.com X-Envelope-To: x86@kernel.org X-Envelope-To: linux-kernel@vger.kernel.org X-Envelope-To: mjguzik@gmail.com X-Envelope-To: tangyouling@kylinos.cn Message-ID: Date: Fri, 31 May 2024 09:17:08 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH 1/2] x86: Remove the prefetch() specific implementation on x86_64 To: Nikolay Borisov , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Mateusz Guzik , Youling Tang References: <20240529032059.899347-1-youling.tang@linux.dev> Content-Language: en-US, en-AU X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Youling Tang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Hi, Nikolay On 30/05/2024 23:26, Nikolay Borisov wrote: > > > On 29.05.24 г. 6:20 ч., Youling Tang wrote: >> From: Youling Tang >> >> After commit ab483570a13b ("x86 & generic: change to >> __builtin_prefetch()"), >> x86_64 directly uses __builtin_prefetch() without the specific >> implementation >> of prefetch(). Also, x86_64 use a generic definition until commit >> ae2e15eb3b6c >> ("x86: unify prefetch operations"). So remove it. > > > So this patch just ensures the x86-specific prefetch() implementation > is defined only for 32bit case, otherwise we have it defined for the > 64bit case as well but effectively it's not used since > ARCH_HAS_PREFETCH is not defined for 64bit, meaning in the 64bit case > prefetch() is still defined to __builtint_prefetch in > include/linux/prefetch.h. > > > In essence this is a purely cosmetic cleanup , am I right? Yes, when arch customization and __builtint_prefetch are implemented with the same instructions, it looks like pure cleaning (without changing the generated assembly). Thanks, Youling. > > > I compiled a file that utilizes prefetch with and without your patch > and the generated assembly is identical. > > > Reviewed-by: Nikolay Borisov > > >> >> Signed-off-by: Youling Tang >> --- >>   arch/x86/include/asm/processor.h | 7 ++++--- >>   1 file changed, 4 insertions(+), 3 deletions(-) >> >> diff --git a/arch/x86/include/asm/processor.h >> b/arch/x86/include/asm/processor.h >> index cb4f6c513c48..44371bdcc59d 100644 >> --- a/arch/x86/include/asm/processor.h >> +++ b/arch/x86/include/asm/processor.h >> @@ -599,9 +599,6 @@ extern char            ignore_fpu_irq; >>   #ifdef CONFIG_X86_32 >>   # define BASE_PREFETCH        "" >>   # define ARCH_HAS_PREFETCH >> -#else >> -# define BASE_PREFETCH        "prefetcht0 %1" >> -#endif >>     /* >>    * Prefetch instructions for Pentium III (+) and AMD Athlon (+) >> @@ -616,6 +613,10 @@ static inline void prefetch(const void *x) >>                 "m" (*(const char *)x)); >>   } >>   +#else >> +# define BASE_PREFETCH        "prefetcht0 %1" >> +#endif >> + >>   /* >>    * 3dnow prefetch to get an exclusive cache line. >>    * Useful for spinlocks to avoid one state transition in the