public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Youling Tang <youling.tang@linux.dev>
To: Nikolay Borisov <nik.borisov@suse.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	Dave Hansen <dave.hansen@linux.intel.com>
Cc: x86@kernel.org, linux-kernel@vger.kernel.org,
	Mateusz Guzik <mjguzik@gmail.com>,
	Youling Tang <tangyouling@kylinos.cn>
Subject: Re: [PATCH 1/2] x86: Remove the prefetch() specific implementation on x86_64
Date: Fri, 31 May 2024 09:17:08 +0800	[thread overview]
Message-ID: <ac6b2f60-e611-422c-9e22-311701f9d4c0@linux.dev> (raw)
In-Reply-To: <ca6c512a-c9cd-4210-bd71-c72c729c95a9@suse.com>

Hi, Nikolay
On 30/05/2024 23:26, Nikolay Borisov wrote:
>
>
> On 29.05.24 г. 6:20 ч., Youling Tang wrote:
>> From: Youling Tang <tangyouling@kylinos.cn>
>>
>> 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 <nik.borisov@suse.com>
>
>
>>
>> Signed-off-by: Youling Tang <tangyouling@kylinos.cn>
>> ---
>>   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

  reply	other threads:[~2024-05-31  1:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-29  3:20 [PATCH 1/2] x86: Remove the prefetch() specific implementation on x86_64 Youling Tang
2024-05-29  3:20 ` [PATCH 2/2] prefetch: Add ARCH_HAS_PREFETCH definition when the architecture is not defined Youling Tang
2024-05-30 15:30   ` Nikolay Borisov
2024-05-29 20:03 ` [PATCH 1/2] x86: Remove the prefetch() specific implementation on x86_64 kernel test robot
2024-05-30  1:51   ` Youling Tang
2024-05-30 15:26 ` Nikolay Borisov
2024-05-31  1:17   ` Youling Tang [this message]
2024-07-24  7:45   ` Youling Tang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ac6b2f60-e611-422c-9e22-311701f9d4c0@linux.dev \
    --to=youling.tang@linux.dev \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=mjguzik@gmail.com \
    --cc=nik.borisov@suse.com \
    --cc=tangyouling@kylinos.cn \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox