* [PATCH 4.19] x86/mm/cpa: Unconditionally avoid WBINDV when we can
@ 2022-07-04 8:28 Wen Yang
2022-07-04 11:05 ` Greg Kroah-Hartman
0 siblings, 1 reply; 13+ messages in thread
From: Wen Yang @ 2022-07-04 8:28 UTC (permalink / raw)
To: Greg Kroah-Hartman, Sasha Levin
Cc: Peter Zijlstra, Thomas Gleixner, Dave Hansen, Bin Yang,
Mark Gross, stable, Wen Yang
From: Peter Zijlstra <peterz@infradead.org>
commit ab3e9c0b75dcb13e9254ef68caa7f15bc66b6471 upstream.
CAT has happened, WBINDV is bad (even before CAT blowing away the
entire cache on a multi-core platform wasn't nice), try not to use it
ever.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Dave Hansen <dave.hansen@intel.com>
Cc: Bin Yang <bin.yang@intel.com>
Cc: Mark Gross <mark.gross@intel.com>
Link: https://lkml.kernel.org/r/20180919085947.933674526@infradead.org
Cc: <stable@vger.kernel.org> # 4.19.x
Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
---
arch/x86/mm/pageattr.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 101f3ad0d6ad..ab87da7a6043 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -239,26 +239,12 @@ static void cpa_flush_array(unsigned long *start, int numpages, int cache,
int in_flags, struct page **pages)
{
unsigned int i, level;
-#ifdef CONFIG_PREEMPT
- /*
- * Avoid wbinvd() because it causes latencies on all CPUs,
- * regardless of any CPU isolation that may be in effect.
- *
- * This should be extended for CAT enabled systems independent of
- * PREEMPT because wbinvd() does not respect the CAT partitions and
- * this is exposed to unpriviledged users through the graphics
- * subsystem.
- */
- unsigned long do_wbinvd = 0;
-#else
- unsigned long do_wbinvd = cache && numpages >= 1024; /* 4M threshold */
-#endif
BUG_ON(irqs_disabled() && !early_boot_irqs_disabled);
- on_each_cpu(__cpa_flush_all, (void *) do_wbinvd, 1);
+ flush_tlb_all();
- if (!cache || do_wbinvd)
+ if (!cache)
return;
/*
--
2.19.1.6.gb485710b
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 4.19] x86/mm/cpa: Unconditionally avoid WBINDV when we can
2022-07-04 8:28 Wen Yang
@ 2022-07-04 11:05 ` Greg Kroah-Hartman
2022-07-04 14:29 ` Wen Yang
0 siblings, 1 reply; 13+ messages in thread
From: Greg Kroah-Hartman @ 2022-07-04 11:05 UTC (permalink / raw)
To: Wen Yang
Cc: Sasha Levin, Peter Zijlstra, Thomas Gleixner, Dave Hansen,
Bin Yang, Mark Gross, stable
On Mon, Jul 04, 2022 at 04:28:17PM +0800, Wen Yang wrote:
> From: Peter Zijlstra <peterz@infradead.org>
>
> commit ab3e9c0b75dcb13e9254ef68caa7f15bc66b6471 upstream.
This commit id is not in Linus's tree :(
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4.19] x86/mm/cpa: Unconditionally avoid WBINDV when we can
2022-07-04 11:05 ` Greg Kroah-Hartman
@ 2022-07-04 14:29 ` Wen Yang
2022-07-04 15:05 ` Greg Kroah-Hartman
0 siblings, 1 reply; 13+ messages in thread
From: Wen Yang @ 2022-07-04 14:29 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Sasha Levin, Peter Zijlstra, Thomas Gleixner, Dave Hansen,
Bin Yang, Mark Gross, stable
在 2022/7/4 下午7:05, Greg Kroah-Hartman 写道:
> On Mon, Jul 04, 2022 at 04:28:17PM +0800, Wen Yang wrote:
>> From: Peter Zijlstra <peterz@infradead.org>
>>
>> commit ab3e9c0b75dcb13e9254ef68caa7f15bc66b6471 upstream.
>
> This commit id is not in Linus's tree :(
Sorry, accidentally added the internal id.
It is this commit id in Linus' tree:
ddd07b750382adc2b78fdfbec47af8a6e0d8ef37
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ddd07b750382adc2b78fdfbec47af8a6e0d8ef37
--
Best wishes,
Wen
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4.19] x86/mm/cpa: Unconditionally avoid WBINDV when we can
2022-07-04 14:29 ` Wen Yang
@ 2022-07-04 15:05 ` Greg Kroah-Hartman
0 siblings, 0 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2022-07-04 15:05 UTC (permalink / raw)
To: Wen Yang
Cc: Sasha Levin, Peter Zijlstra, Thomas Gleixner, Dave Hansen,
Bin Yang, Mark Gross, stable
On Mon, Jul 04, 2022 at 10:29:57PM +0800, Wen Yang wrote:
>
>
> 在 2022/7/4 下午7:05, Greg Kroah-Hartman 写道:
> > On Mon, Jul 04, 2022 at 04:28:17PM +0800, Wen Yang wrote:
> > > From: Peter Zijlstra <peterz@infradead.org>
> > >
> > > commit ab3e9c0b75dcb13e9254ef68caa7f15bc66b6471 upstream.
> >
> > This commit id is not in Linus's tree :(
>
>
> Sorry, accidentally added the internal id.
>
> It is this commit id in Linus' tree:
> ddd07b750382adc2b78fdfbec47af8a6e0d8ef37
>
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ddd07b750382adc2b78fdfbec47af8a6e0d8ef37
Please fix up the patch and resend it with this information.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 4.19] x86/mm/cpa: Unconditionally avoid WBINDV when we can
@ 2022-07-04 15:45 Wen Yang
2022-07-04 15:59 ` Greg Kroah-Hartman
0 siblings, 1 reply; 13+ messages in thread
From: Wen Yang @ 2022-07-04 15:45 UTC (permalink / raw)
To: Greg Kroah-Hartman, Sasha Levin
Cc: Peter Zijlstra, Thomas Gleixner, Dave Hansen, Bin Yang,
Mark Gross, stable, Wen Yang
From: Peter Zijlstra <peterz@infradead.org>
commit ddd07b750382adc2b78fdfbec47af8a6e0d8ef37 upstream.
CAT has happened, WBINDV is bad (even before CAT blowing away the
entire cache on a multi-core platform wasn't nice), try not to use it
ever.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Dave Hansen <dave.hansen@intel.com>
Cc: Bin Yang <bin.yang@intel.com>
Cc: Mark Gross <mark.gross@intel.com>
Link: https://lkml.kernel.org/r/20180919085947.933674526@infradead.org
Cc: <stable@vger.kernel.org> # 4.19.x
Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
---
arch/x86/mm/pageattr.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 101f3ad0d6ad..ab87da7a6043 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -239,26 +239,12 @@ static void cpa_flush_array(unsigned long *start, int numpages, int cache,
int in_flags, struct page **pages)
{
unsigned int i, level;
-#ifdef CONFIG_PREEMPT
- /*
- * Avoid wbinvd() because it causes latencies on all CPUs,
- * regardless of any CPU isolation that may be in effect.
- *
- * This should be extended for CAT enabled systems independent of
- * PREEMPT because wbinvd() does not respect the CAT partitions and
- * this is exposed to unpriviledged users through the graphics
- * subsystem.
- */
- unsigned long do_wbinvd = 0;
-#else
- unsigned long do_wbinvd = cache && numpages >= 1024; /* 4M threshold */
-#endif
BUG_ON(irqs_disabled() && !early_boot_irqs_disabled);
- on_each_cpu(__cpa_flush_all, (void *) do_wbinvd, 1);
+ flush_tlb_all();
- if (!cache || do_wbinvd)
+ if (!cache)
return;
/*
--
2.19.1.6.gb485710b
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 4.19] x86/mm/cpa: Unconditionally avoid WBINDV when we can
2022-07-04 15:45 Wen Yang
@ 2022-07-04 15:59 ` Greg Kroah-Hartman
2022-07-05 3:45 ` Wen Yang
0 siblings, 1 reply; 13+ messages in thread
From: Greg Kroah-Hartman @ 2022-07-04 15:59 UTC (permalink / raw)
To: Wen Yang
Cc: Sasha Levin, Peter Zijlstra, Thomas Gleixner, Dave Hansen,
Bin Yang, Mark Gross, stable
On Mon, Jul 04, 2022 at 11:45:08PM +0800, Wen Yang wrote:
> From: Peter Zijlstra <peterz@infradead.org>
>
> commit ddd07b750382adc2b78fdfbec47af8a6e0d8ef37 upstream.
>
> CAT has happened, WBINDV is bad (even before CAT blowing away the
> entire cache on a multi-core platform wasn't nice), try not to use it
> ever.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Reviewed-by: Dave Hansen <dave.hansen@intel.com>
> Cc: Bin Yang <bin.yang@intel.com>
> Cc: Mark Gross <mark.gross@intel.com>
> Link: https://lkml.kernel.org/r/20180919085947.933674526@infradead.org
> Cc: <stable@vger.kernel.org> # 4.19.x
> Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
> ---
> arch/x86/mm/pageattr.c | 18 ++----------------
> 1 file changed, 2 insertions(+), 16 deletions(-)
>
> diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
> index 101f3ad0d6ad..ab87da7a6043 100644
> --- a/arch/x86/mm/pageattr.c
> +++ b/arch/x86/mm/pageattr.c
> @@ -239,26 +239,12 @@ static void cpa_flush_array(unsigned long *start, int numpages, int cache,
> int in_flags, struct page **pages)
> {
> unsigned int i, level;
> -#ifdef CONFIG_PREEMPT
> - /*
> - * Avoid wbinvd() because it causes latencies on all CPUs,
> - * regardless of any CPU isolation that may be in effect.
> - *
> - * This should be extended for CAT enabled systems independent of
> - * PREEMPT because wbinvd() does not respect the CAT partitions and
> - * this is exposed to unpriviledged users through the graphics
> - * subsystem.
> - */
> - unsigned long do_wbinvd = 0;
> -#else
> - unsigned long do_wbinvd = cache && numpages >= 1024; /* 4M threshold */
> -#endif
>
> BUG_ON(irqs_disabled() && !early_boot_irqs_disabled);
>
> - on_each_cpu(__cpa_flush_all, (void *) do_wbinvd, 1);
> + flush_tlb_all();
>
> - if (!cache || do_wbinvd)
> + if (!cache)
> return;
>
> /*
> --
> 2.19.1.6.gb485710b
>
Why is this needed on 4.19.y? What problem does it solve, it looks only
like an optimization, not a bugfix.
And if it's a bugfix, why only 4.19.y, why not older kernels too?
We need more information here please.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4.19] x86/mm/cpa: Unconditionally avoid WBINDV when we can
2022-07-04 15:59 ` Greg Kroah-Hartman
@ 2022-07-05 3:45 ` Wen Yang
2022-07-05 4:18 ` Dave Hansen
2022-07-05 4:39 ` Greg Kroah-Hartman
0 siblings, 2 replies; 13+ messages in thread
From: Wen Yang @ 2022-07-05 3:45 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Sasha Levin, Peter Zijlstra, Thomas Gleixner, Dave Hansen,
Bin Yang, Mark Gross, stable
在 2022/7/4 下午11:59, Greg Kroah-Hartman 写道:
> On Mon, Jul 04, 2022 at 11:45:08PM +0800, Wen Yang wrote:
>> From: Peter Zijlstra <peterz@infradead.org>
>>
>> commit ddd07b750382adc2b78fdfbec47af8a6e0d8ef37 upstream.
>>
>> CAT has happened, WBINDV is bad (even before CAT blowing away the
>> entire cache on a multi-core platform wasn't nice), try not to use it
>> ever.
>>
>> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
>> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
>> Reviewed-by: Dave Hansen <dave.hansen@intel.com>
>> Cc: Bin Yang <bin.yang@intel.com>
>> Cc: Mark Gross <mark.gross@intel.com>
>> Link: https://lkml.kernel.org/r/20180919085947.933674526@infradead.org
>> Cc: <stable@vger.kernel.org> # 4.19.x
>> Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
>> ---
>> arch/x86/mm/pageattr.c | 18 ++----------------
>> 1 file changed, 2 insertions(+), 16 deletions(-)
>>
>> diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
>> index 101f3ad0d6ad..ab87da7a6043 100644
>> --- a/arch/x86/mm/pageattr.c
>> +++ b/arch/x86/mm/pageattr.c
>> @@ -239,26 +239,12 @@ static void cpa_flush_array(unsigned long *start, int numpages, int cache,
>> int in_flags, struct page **pages)
>> {
>> unsigned int i, level;
>> -#ifdef CONFIG_PREEMPT
>> - /*
>> - * Avoid wbinvd() because it causes latencies on all CPUs,
>> - * regardless of any CPU isolation that may be in effect.
>> - *
>> - * This should be extended for CAT enabled systems independent of
>> - * PREEMPT because wbinvd() does not respect the CAT partitions and
>> - * this is exposed to unpriviledged users through the graphics
>> - * subsystem.
>> - */
>> - unsigned long do_wbinvd = 0;
>> -#else
>> - unsigned long do_wbinvd = cache && numpages >= 1024; /* 4M threshold */
>> -#endif
>>
>> BUG_ON(irqs_disabled() && !early_boot_irqs_disabled);
>>
>> - on_each_cpu(__cpa_flush_all, (void *) do_wbinvd, 1);
>> + flush_tlb_all();
>>
>> - if (!cache || do_wbinvd)
>> + if (!cache)
>> return;
>>
>> /*
>> --
>> 2.19.1.6.gb485710b
>>
>
> Why is this needed on 4.19.y? What problem does it solve, it looks only
> like an optimization, not a bugfix.
>
> And if it's a bugfix, why only 4.19.y, why not older kernels too?
>
> We need more information here please.
>
On a 128-core Intel(R) Xeon(R) Platinum 8369B CPU @ 2.90GHz server, when
the user program frequently calls nv_alloc_system_pages to allocate
large memory, it often causes a delay of about 200 milliseconds for the
entire system. In this way, other latency-sensitive tasks on this system
are heavily impacted, causing stability issues in large-scale clusters
as well.
nv_alloc_system_pages
-> _set_memory_array
-> change_page_attr_set_clr
-> cpa_flush_array
-> on_each_cpu(__cpa_flush_all, (void *) do_wbinvd, 1);
This patch can be directly merged into the 4.19 kernel to solve this
problem, and most of the machines in our production environment are 4.19
kernels.
We're also happy to apply it to the 4.14 and 4.9 kernels, and send the
corresponding patches soon, although there are very few such servers in
our production clusters.
--
Best wishes,
Wen
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4.19] x86/mm/cpa: Unconditionally avoid WBINDV when we can
2022-07-05 3:45 ` Wen Yang
@ 2022-07-05 4:18 ` Dave Hansen
2022-07-05 4:39 ` Greg Kroah-Hartman
1 sibling, 0 replies; 13+ messages in thread
From: Dave Hansen @ 2022-07-05 4:18 UTC (permalink / raw)
To: Wen Yang, Greg Kroah-Hartman
Cc: Sasha Levin, Peter Zijlstra, Thomas Gleixner, Bin Yang,
Mark Gross, stable
On 7/4/22 20:45, Wen Yang wrote:> On a 128-core Intel(R) Xeon(R)
Platinum 8369B CPU @ 2.90GHz server,
> when the user program frequently calls nv_alloc_system_pages to
> allocate large memory,
We seem to be repeating the same conversation we had back in November of
last year:
> https://lore.kernel.org/all/9c415df9-9575-8217-03e9-a6bbf20a491a@linux.alibaba.com/T/#u
It's the binary nvidia driver doing unusual stuff again. Please talk to
the folks you got that driver from.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 4.19] x86/mm/cpa: Unconditionally avoid WBINDV when we can
2022-07-05 3:45 ` Wen Yang
2022-07-05 4:18 ` Dave Hansen
@ 2022-07-05 4:39 ` Greg Kroah-Hartman
1 sibling, 0 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2022-07-05 4:39 UTC (permalink / raw)
To: Wen Yang
Cc: Sasha Levin, Peter Zijlstra, Thomas Gleixner, Dave Hansen,
Bin Yang, Mark Gross, stable
On Tue, Jul 05, 2022 at 11:45:29AM +0800, Wen Yang wrote:
>
>
> 在 2022/7/4 下午11:59, Greg Kroah-Hartman 写道:
> > On Mon, Jul 04, 2022 at 11:45:08PM +0800, Wen Yang wrote:
> > > From: Peter Zijlstra <peterz@infradead.org>
> > >
> > > commit ddd07b750382adc2b78fdfbec47af8a6e0d8ef37 upstream.
> > >
> > > CAT has happened, WBINDV is bad (even before CAT blowing away the
> > > entire cache on a multi-core platform wasn't nice), try not to use it
> > > ever.
> > >
> > > Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> > > Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> > > Reviewed-by: Dave Hansen <dave.hansen@intel.com>
> > > Cc: Bin Yang <bin.yang@intel.com>
> > > Cc: Mark Gross <mark.gross@intel.com>
> > > Link: https://lkml.kernel.org/r/20180919085947.933674526@infradead.org
> > > Cc: <stable@vger.kernel.org> # 4.19.x
> > > Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
> > > ---
> > > arch/x86/mm/pageattr.c | 18 ++----------------
> > > 1 file changed, 2 insertions(+), 16 deletions(-)
> > >
> > > diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
> > > index 101f3ad0d6ad..ab87da7a6043 100644
> > > --- a/arch/x86/mm/pageattr.c
> > > +++ b/arch/x86/mm/pageattr.c
> > > @@ -239,26 +239,12 @@ static void cpa_flush_array(unsigned long *start, int numpages, int cache,
> > > int in_flags, struct page **pages)
> > > {
> > > unsigned int i, level;
> > > -#ifdef CONFIG_PREEMPT
> > > - /*
> > > - * Avoid wbinvd() because it causes latencies on all CPUs,
> > > - * regardless of any CPU isolation that may be in effect.
> > > - *
> > > - * This should be extended for CAT enabled systems independent of
> > > - * PREEMPT because wbinvd() does not respect the CAT partitions and
> > > - * this is exposed to unpriviledged users through the graphics
> > > - * subsystem.
> > > - */
> > > - unsigned long do_wbinvd = 0;
> > > -#else
> > > - unsigned long do_wbinvd = cache && numpages >= 1024; /* 4M threshold */
> > > -#endif
> > > BUG_ON(irqs_disabled() && !early_boot_irqs_disabled);
> > > - on_each_cpu(__cpa_flush_all, (void *) do_wbinvd, 1);
> > > + flush_tlb_all();
> > > - if (!cache || do_wbinvd)
> > > + if (!cache)
> > > return;
> > > /*
> > > --
> > > 2.19.1.6.gb485710b
> > >
> >
> > Why is this needed on 4.19.y? What problem does it solve, it looks only
> > like an optimization, not a bugfix.
> >
> > And if it's a bugfix, why only 4.19.y, why not older kernels too?
> >
> > We need more information here please.
> >
>
> On a 128-core Intel(R) Xeon(R) Platinum 8369B CPU @ 2.90GHz server, when the
> user program frequently calls nv_alloc_system_pages to allocate large
> memory, it often causes a delay of about 200 milliseconds for the entire
> system. In this way, other latency-sensitive tasks on this system are
> heavily impacted, causing stability issues in large-scale clusters as well.
>
> nv_alloc_system_pages
> -> _set_memory_array
> -> change_page_attr_set_clr
> -> cpa_flush_array
> -> on_each_cpu(__cpa_flush_all, (void *) do_wbinvd, 1);
>
>
> This patch can be directly merged into the 4.19 kernel to solve this
> problem, and most of the machines in our production environment are 4.19
> kernels.
Ah. So what has changed from last year when I rejected this then:
https://lore.kernel.org/all/9c415df9-9575-8217-03e9-a6bbf20a491a@linux.alibaba.com/T/#m06369d080fa97eda3dd6a8eaf54a8ca2d430b3ab
Please do not try to submit previously-rejected patches, that is very
disingenuous.
greg k-h
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 4.19] x86/mm/cpa: Unconditionally avoid WBINDV when we can
@ 2022-07-05 6:02 Wen Yang
2022-07-05 6:02 ` [PATCH 4.14] " Wen Yang
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Wen Yang @ 2022-07-05 6:02 UTC (permalink / raw)
To: Greg Kroah-Hartman, Sasha Levin
Cc: Peter Zijlstra, Thomas Gleixner, Dave Hansen, Bin Yang,
Mark Gross, stable, Wen Yang
From: Peter Zijlstra <peterz@infradead.org>
commit ddd07b750382adc2b78fdfbec47af8a6e0d8ef37 upstream.
CAT has happened, WBINDV is bad (even before CAT blowing away the
entire cache on a multi-core platform wasn't nice), try not to use it
ever.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Dave Hansen <dave.hansen@intel.com>
Cc: Bin Yang <bin.yang@intel.com>
Cc: Mark Gross <mark.gross@intel.com>
Link: https://lkml.kernel.org/r/20180919085947.933674526@infradead.org
Cc: <stable@vger.kernel.org> # 4.19.x
Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
---
arch/x86/mm/pageattr.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 101f3ad0d6ad..ab87da7a6043 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -239,26 +239,12 @@ static void cpa_flush_array(unsigned long *start, int numpages, int cache,
int in_flags, struct page **pages)
{
unsigned int i, level;
-#ifdef CONFIG_PREEMPT
- /*
- * Avoid wbinvd() because it causes latencies on all CPUs,
- * regardless of any CPU isolation that may be in effect.
- *
- * This should be extended for CAT enabled systems independent of
- * PREEMPT because wbinvd() does not respect the CAT partitions and
- * this is exposed to unpriviledged users through the graphics
- * subsystem.
- */
- unsigned long do_wbinvd = 0;
-#else
- unsigned long do_wbinvd = cache && numpages >= 1024; /* 4M threshold */
-#endif
BUG_ON(irqs_disabled() && !early_boot_irqs_disabled);
- on_each_cpu(__cpa_flush_all, (void *) do_wbinvd, 1);
+ flush_tlb_all();
- if (!cache || do_wbinvd)
+ if (!cache)
return;
/*
--
2.19.1.6.gb485710b
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4.14] x86/mm/cpa: Unconditionally avoid WBINDV when we can
2022-07-05 6:02 [PATCH 4.19] x86/mm/cpa: Unconditionally avoid WBINDV when we can Wen Yang
@ 2022-07-05 6:02 ` Wen Yang
2022-07-05 6:02 ` [PATCH 4.9] " Wen Yang
2022-07-05 6:26 ` [PATCH 4.19] " Greg Kroah-Hartman
2 siblings, 0 replies; 13+ messages in thread
From: Wen Yang @ 2022-07-05 6:02 UTC (permalink / raw)
To: Greg Kroah-Hartman, Sasha Levin
Cc: Peter Zijlstra, Thomas Gleixner, Dave Hansen, Bin Yang,
Mark Gross, stable, Wen Yang
From: Peter Zijlstra <peterz@infradead.org>
commit ddd07b750382adc2b78fdfbec47af8a6e0d8ef37 upstream.
CAT has happened, WBINDV is bad (even before CAT blowing away the
entire cache on a multi-core platform wasn't nice), try not to use it
ever.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Dave Hansen <dave.hansen@intel.com>
Cc: Bin Yang <bin.yang@intel.com>
Cc: Mark Gross <mark.gross@intel.com>
Link: https://lkml.kernel.org/r/20180919085947.933674526@infradead.org
Cc: <stable@vger.kernel.org> # 4.14.x: d2479a3: x86/pti: Fix boot problems from Global-bit setting
Cc: <stable@vger.kernel.org> # 4.14.x
Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
---
arch/x86/mm/pageattr.c | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 101f3ad0d6ad..ab87da7a6043 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -239,26 +239,12 @@ static void cpa_flush_array(unsigned long *start, int numpages, int cache,
int in_flags, struct page **pages)
{
unsigned int i, level;
-#ifdef CONFIG_PREEMPT
- /*
- * Avoid wbinvd() because it causes latencies on all CPUs,
- * regardless of any CPU isolation that may be in effect.
- *
- * This should be extended for CAT enabled systems independent of
- * PREEMPT because wbinvd() does not respect the CAT partitions and
- * this is exposed to unpriviledged users through the graphics
- * subsystem.
- */
- unsigned long do_wbinvd = 0;
-#else
- unsigned long do_wbinvd = cache && numpages >= 1024; /* 4M threshold */
-#endif
BUG_ON(irqs_disabled() && !early_boot_irqs_disabled);
- on_each_cpu(__cpa_flush_all, (void *) do_wbinvd, 1);
+ flush_tlb_all();
- if (!cache || do_wbinvd)
+ if (!cache)
return;
/*
--
2.19.1.6.gb485710b
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4.9] x86/mm/cpa: Unconditionally avoid WBINDV when we can
2022-07-05 6:02 [PATCH 4.19] x86/mm/cpa: Unconditionally avoid WBINDV when we can Wen Yang
2022-07-05 6:02 ` [PATCH 4.14] " Wen Yang
@ 2022-07-05 6:02 ` Wen Yang
2022-07-05 6:26 ` [PATCH 4.19] " Greg Kroah-Hartman
2 siblings, 0 replies; 13+ messages in thread
From: Wen Yang @ 2022-07-05 6:02 UTC (permalink / raw)
To: Greg Kroah-Hartman, Sasha Levin
Cc: Wen Yang, Peter Zijlstra, Thomas Gleixner, Dave Hansen, Bin Yang,
Mark Gross, stable, Wen Yang
From: Wen Yang <simon.wy@alibaba-inc.com>
commit ddd07b750382adc2b78fdfbec47af8a6e0d8ef37 upstream.
CAT has happened, WBINDV is bad (even before CAT blowing away the
entire cache on a multi-core platform wasn't nice), try not to use it
ever.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Dave Hansen <dave.hansen@intel.com>
Cc: Bin Yang <bin.yang@intel.com>
Cc: Mark Gross <mark.gross@intel.com>
Link: https://lkml.kernel.org/r/20180919085947.933674526@infradead.org
Cc: <stable@vger.kernel.org> # 4.9.x: d2479a3: x86/pti: Fix boot problems from Global-bit setting
Cc: <stable@vger.kernel.org> # 4.9.x
Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
---
arch/x86/mm/pageattr.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index a586faeab0e5..e1b5b603eb48 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -215,13 +215,12 @@ static void cpa_flush_array(unsigned long *start, int numpages, int cache,
int in_flags, struct page **pages)
{
unsigned int i, level;
- unsigned long do_wbinvd = cache && numpages >= 1024; /* 4M threshold */
BUG_ON(irqs_disabled() && !early_boot_irqs_disabled);
- on_each_cpu(__cpa_flush_all, (void *) do_wbinvd, 1);
+ flush_tlb_all();
- if (!cache || do_wbinvd)
+ if (!cache)
return;
/*
--
2.19.1.6.gb485710b
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 4.19] x86/mm/cpa: Unconditionally avoid WBINDV when we can
2022-07-05 6:02 [PATCH 4.19] x86/mm/cpa: Unconditionally avoid WBINDV when we can Wen Yang
2022-07-05 6:02 ` [PATCH 4.14] " Wen Yang
2022-07-05 6:02 ` [PATCH 4.9] " Wen Yang
@ 2022-07-05 6:26 ` Greg Kroah-Hartman
2 siblings, 0 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2022-07-05 6:26 UTC (permalink / raw)
To: Wen Yang
Cc: Sasha Levin, Peter Zijlstra, Thomas Gleixner, Dave Hansen,
Bin Yang, Mark Gross, stable
On Tue, Jul 05, 2022 at 02:02:07PM +0800, Wen Yang wrote:
> From: Peter Zijlstra <peterz@infradead.org>
>
> commit ddd07b750382adc2b78fdfbec47af8a6e0d8ef37 upstream.
>
> CAT has happened, WBINDV is bad (even before CAT blowing away the
> entire cache on a multi-core platform wasn't nice), try not to use it
> ever.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> Reviewed-by: Dave Hansen <dave.hansen@intel.com>
> Cc: Bin Yang <bin.yang@intel.com>
> Cc: Mark Gross <mark.gross@intel.com>
> Link: https://lkml.kernel.org/r/20180919085947.933674526@infradead.org
> Cc: <stable@vger.kernel.org> # 4.19.x
> Signed-off-by: Wen Yang <wenyang@linux.alibaba.com>
> ---
> arch/x86/mm/pageattr.c | 18 ++----------------
> 1 file changed, 2 insertions(+), 16 deletions(-)
>
> diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
> index 101f3ad0d6ad..ab87da7a6043 100644
> --- a/arch/x86/mm/pageattr.c
> +++ b/arch/x86/mm/pageattr.c
> @@ -239,26 +239,12 @@ static void cpa_flush_array(unsigned long *start, int numpages, int cache,
> int in_flags, struct page **pages)
> {
> unsigned int i, level;
> -#ifdef CONFIG_PREEMPT
> - /*
> - * Avoid wbinvd() because it causes latencies on all CPUs,
> - * regardless of any CPU isolation that may be in effect.
> - *
> - * This should be extended for CAT enabled systems independent of
> - * PREEMPT because wbinvd() does not respect the CAT partitions and
> - * this is exposed to unpriviledged users through the graphics
> - * subsystem.
> - */
> - unsigned long do_wbinvd = 0;
> -#else
> - unsigned long do_wbinvd = cache && numpages >= 1024; /* 4M threshold */
> -#endif
>
> BUG_ON(irqs_disabled() && !early_boot_irqs_disabled);
>
> - on_each_cpu(__cpa_flush_all, (void *) do_wbinvd, 1);
> + flush_tlb_all();
>
> - if (!cache || do_wbinvd)
> + if (!cache)
> return;
>
> /*
> --
> 2.19.1.6.gb485710b
>
As stated before, I am not allowed to accept this due to it being a
requirement of a closed source kernel module. Please do not keep
resending it hoping we will forget or I will have to add this to my
email filters.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2022-07-05 6:27 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-05 6:02 [PATCH 4.19] x86/mm/cpa: Unconditionally avoid WBINDV when we can Wen Yang
2022-07-05 6:02 ` [PATCH 4.14] " Wen Yang
2022-07-05 6:02 ` [PATCH 4.9] " Wen Yang
2022-07-05 6:26 ` [PATCH 4.19] " Greg Kroah-Hartman
-- strict thread matches above, loose matches on Subject: below --
2022-07-04 15:45 Wen Yang
2022-07-04 15:59 ` Greg Kroah-Hartman
2022-07-05 3:45 ` Wen Yang
2022-07-05 4:18 ` Dave Hansen
2022-07-05 4:39 ` Greg Kroah-Hartman
2022-07-04 8:28 Wen Yang
2022-07-04 11:05 ` Greg Kroah-Hartman
2022-07-04 14:29 ` Wen Yang
2022-07-04 15:05 ` Greg Kroah-Hartman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).