All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/fpu: fix compile error without kernel_fpu_disabled()
@ 2022-05-16 15:32 jamienstar
  2022-05-16 15:59 ` Bezdeka, Florian
  0 siblings, 1 reply; 7+ messages in thread
From: jamienstar @ 2022-05-16 15:32 UTC (permalink / raw)
  To: rpm; +Cc: jamienstar, xenomai

From: Jamie <jamienstar@163.com>

In v5.18-evl-rebase, function kernel_fpu_disabled() has been removed in
commit 59f5ede3bc0f("x86/fpu: Prevent FPU state corruption"), so we will
get compile error when CONFIG_DOVETAIL is enabled:
arch/x86/kernel/fpu/core.c:931:6: error: implicit declaration of function ‘kernel_fpu_disabled’; did you mean ‘perf_pmu_disable’? [-Werror=implicit-function-declaration]
  if (kernel_fpu_disabled()) {
      ^~~~~~~~~~~~~~~~~~~
      perf_pmu_disable
cc1: all warnings being treated as errors
So, fix it.

Signed-off-by: Jamie <jamienstar@163.com>
---
 arch/x86/kernel/fpu/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
index 6a0d1e7f278f..c3adbbb73226 100644
--- a/arch/x86/kernel/fpu/core.c
+++ b/arch/x86/kernel/fpu/core.c
@@ -928,7 +928,7 @@ void fpu__suspend_inband(void)
 	 * preemption of an inband kernel context currently using the
 	 * fpu by a thread which resumes on the oob stage.
 	 */
-	if (kernel_fpu_disabled()) {
+	if (this_cpu_read(in_kernel_fpu)) {
 		save_fpregs_to_fpstate(kfpu);
 		__cpu_invalidate_fpregs_state();
 		oob_fpu_set_preempt(&tsk->thread.fpu);
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/fpu: fix compile error without kernel_fpu_disabled()
  2022-05-16 15:32 [PATCH] x86/fpu: fix compile error without kernel_fpu_disabled() jamienstar
@ 2022-05-16 15:59 ` Bezdeka, Florian
  2022-05-24  6:39   ` Jan Kiszka
  0 siblings, 1 reply; 7+ messages in thread
From: Bezdeka, Florian @ 2022-05-16 15:59 UTC (permalink / raw)
  To: rpm, jamienstar; +Cc: xenomai

On Mon, 2022-05-16 at 23:32 +0800, Jamie Huang via Xenomai wrote:
> From: Jamie <jamienstar@163.com>

It's up to Jan but I guess a complete name would be nice here. Same
fore the Signed-off-by below.

> 
> In v5.18-evl-rebase, function kernel_fpu_disabled() has been removed in
> commit 59f5ede3bc0f("x86/fpu: Prevent FPU state corruption"), so we will
> get compile error when CONFIG_DOVETAIL is enabled:
> arch/x86/kernel/fpu/core.c:931:6: error: implicit declaration of function ‘kernel_fpu_disabled’; did you mean ‘perf_pmu_disable’? [-Werror=implicit-function-declaration]
>   if (kernel_fpu_disabled()) {
>       ^~~~~~~~~~~~~~~~~~~
>       perf_pmu_disable
> cc1: all warnings being treated as errors
> So, fix it.
> 
> Signed-off-by: Jamie <jamienstar@163.com>
> ---
>  arch/x86/kernel/fpu/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
> index 6a0d1e7f278f..c3adbbb73226 100644
> --- a/arch/x86/kernel/fpu/core.c
> +++ b/arch/x86/kernel/fpu/core.c
> @@ -928,7 +928,7 @@ void fpu__suspend_inband(void)
>  	 * preemption of an inband kernel context currently using the
>  	 * fpu by a thread which resumes on the oob stage.
>  	 */
> -	if (kernel_fpu_disabled()) {
> +	if (this_cpu_read(in_kernel_fpu)) {
>  		save_fpregs_to_fpstate(kfpu);
>  		__cpu_invalidate_fpregs_state();
>  		oob_fpu_set_preempt(&tsk->thread.fpu);

Reviewed-By: Florian Bezdeka <florian.bezdeka@siemens.com>

I noticed that while investigating the FPU test issue that I already
reported, but missed that we already have a dovetail branch which is
affected.

Non-Git reference would be
https://lore.kernel.org/lkml/20220501193102.588689270@linutronix.de/


Best regards,
Florian Bezdeka


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/fpu: fix compile error without kernel_fpu_disabled()
  2022-05-16 15:59 ` Bezdeka, Florian
@ 2022-05-24  6:39   ` Jan Kiszka
  0 siblings, 0 replies; 7+ messages in thread
From: Jan Kiszka @ 2022-05-24  6:39 UTC (permalink / raw)
  To: Bezdeka, Florian, rpm, jamienstar; +Cc: xenomai

On 16.05.22 17:59, Bezdeka, Florian via Xenomai wrote:
> On Mon, 2022-05-16 at 23:32 +0800, Jamie Huang via Xenomai wrote:
>> From: Jamie <jamienstar@163.com>
> 
> It's up to Jan but I guess a complete name would be nice here. Same
> fore the Signed-off-by below.

Philippe is maintaining the dovetail tree but, yes, we generally need a
real name to be able to check back regarding
https://developercertificate.org if any questions should arise in the
future.

Jan

> 
>>
>> In v5.18-evl-rebase, function kernel_fpu_disabled() has been removed in
>> commit 59f5ede3bc0f("x86/fpu: Prevent FPU state corruption"), so we will
>> get compile error when CONFIG_DOVETAIL is enabled:
>> arch/x86/kernel/fpu/core.c:931:6: error: implicit declaration of function ‘kernel_fpu_disabled’; did you mean ‘perf_pmu_disable’? [-Werror=implicit-function-declaration]
>>   if (kernel_fpu_disabled()) {
>>       ^~~~~~~~~~~~~~~~~~~
>>       perf_pmu_disable
>> cc1: all warnings being treated as errors
>> So, fix it.
>>
>> Signed-off-by: Jamie <jamienstar@163.com>
>> ---
>>  arch/x86/kernel/fpu/core.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
>> index 6a0d1e7f278f..c3adbbb73226 100644
>> --- a/arch/x86/kernel/fpu/core.c
>> +++ b/arch/x86/kernel/fpu/core.c
>> @@ -928,7 +928,7 @@ void fpu__suspend_inband(void)
>>  	 * preemption of an inband kernel context currently using the
>>  	 * fpu by a thread which resumes on the oob stage.
>>  	 */
>> -	if (kernel_fpu_disabled()) {
>> +	if (this_cpu_read(in_kernel_fpu)) {
>>  		save_fpregs_to_fpstate(kfpu);
>>  		__cpu_invalidate_fpregs_state();
>>  		oob_fpu_set_preempt(&tsk->thread.fpu);
> 
> Reviewed-By: Florian Bezdeka <florian.bezdeka@siemens.com>
> 
> I noticed that while investigating the FPU test issue that I already
> reported, but missed that we already have a dovetail branch which is
> affected.
> 
> Non-Git reference would be
> https://lore.kernel.org/lkml/20220501193102.588689270@linutronix.de/
> 
> 
> Best regards,
> Florian Bezdeka
> 

-- 
Siemens AG, Technology
Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/fpu: fix compile error without kernel_fpu_disabled()
  2022-06-09  5:45   ` Jan Kiszka
@ 2022-06-09  8:43     ` Philippe Gerum
  0 siblings, 0 replies; 7+ messages in thread
From: Philippe Gerum @ 2022-06-09  8:43 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: jamienstar, florian.bezdeka, xenomai


Jan Kiszka <jan.kiszka@siemens.com> writes:

> On 26.05.22 18:19, Philippe Gerum wrote:
>> 
>> jamienstar@163.com writes:
>> 
>>> From: Jamie Huang <jamienstar@163.com>
>>>
>>> In v5.18-evl-rebase, function kernel_fpu_disabled() has been removed in
>>> commit 59f5ede3bc0f("x86/fpu: Prevent FPU state corruption"), so we will
>>> get compile error when CONFIG_DOVETAIL is enabled:
>>> arch/x86/kernel/fpu/core.c:931:6: error: implicit declaration of function ‘kernel_fpu_disabled’; did you mean ‘perf_pmu_disable’? [-Werror=implicit-function-declaration]
>>>     if (kernel_fpu_disabled()) {
>>>         ^~~~~~~~~~~~~~~~~~~
>>>         perf_pmu_disable
>>> cc1: all warnings being treated as errors
>>> So, fix it.
>>>
>>> Signed-off-by: Jamie Huang <jamienstar@163.com>
>>> ---
>>>  arch/x86/kernel/fpu/core.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
>>> index 6a0d1e7f278f..c3adbbb73226 100644
>>> --- a/arch/x86/kernel/fpu/core.c
>>> +++ b/arch/x86/kernel/fpu/core.c
>>> @@ -928,7 +928,7 @@ void fpu__suspend_inband(void)
>>>  	 * preemption of an inband kernel context currently using the
>>>  	 * fpu by a thread which resumes on the oob stage.
>>>  	 */
>>> -	if (kernel_fpu_disabled()) {
>>> +	if (this_cpu_read(in_kernel_fpu)) {
>>>  		save_fpregs_to_fpstate(kfpu);
>>>  		__cpu_invalidate_fpregs_state();
>>>  		oob_fpu_set_preempt(&tsk->thread.fpu);
>> 
>> Merged adding the same fixup to the comment nearby, thanks.
>> 
>
> Could you backport to 5.15 as well?
>
> https://gitlab.com/Xenomai/xenomai-hacker-space/-/jobs/2563340960
>

Done, this should build now.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/fpu: fix compile error without kernel_fpu_disabled()
  2022-05-26 16:19 ` Philippe Gerum
@ 2022-06-09  5:45   ` Jan Kiszka
  2022-06-09  8:43     ` Philippe Gerum
  0 siblings, 1 reply; 7+ messages in thread
From: Jan Kiszka @ 2022-06-09  5:45 UTC (permalink / raw)
  To: Philippe Gerum, jamienstar; +Cc: florian.bezdeka, xenomai

On 26.05.22 18:19, Philippe Gerum wrote:
> 
> jamienstar@163.com writes:
> 
>> From: Jamie Huang <jamienstar@163.com>
>>
>> In v5.18-evl-rebase, function kernel_fpu_disabled() has been removed in
>> commit 59f5ede3bc0f("x86/fpu: Prevent FPU state corruption"), so we will
>> get compile error when CONFIG_DOVETAIL is enabled:
>> arch/x86/kernel/fpu/core.c:931:6: error: implicit declaration of function ‘kernel_fpu_disabled’; did you mean ‘perf_pmu_disable’? [-Werror=implicit-function-declaration]
>>     if (kernel_fpu_disabled()) {
>>         ^~~~~~~~~~~~~~~~~~~
>>         perf_pmu_disable
>> cc1: all warnings being treated as errors
>> So, fix it.
>>
>> Signed-off-by: Jamie Huang <jamienstar@163.com>
>> ---
>>  arch/x86/kernel/fpu/core.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
>> index 6a0d1e7f278f..c3adbbb73226 100644
>> --- a/arch/x86/kernel/fpu/core.c
>> +++ b/arch/x86/kernel/fpu/core.c
>> @@ -928,7 +928,7 @@ void fpu__suspend_inband(void)
>>  	 * preemption of an inband kernel context currently using the
>>  	 * fpu by a thread which resumes on the oob stage.
>>  	 */
>> -	if (kernel_fpu_disabled()) {
>> +	if (this_cpu_read(in_kernel_fpu)) {
>>  		save_fpregs_to_fpstate(kfpu);
>>  		__cpu_invalidate_fpregs_state();
>>  		oob_fpu_set_preempt(&tsk->thread.fpu);
> 
> Merged adding the same fixup to the comment nearby, thanks.
> 

Could you backport to 5.15 as well?

https://gitlab.com/Xenomai/xenomai-hacker-space/-/jobs/2563340960

Thanks,
Jan

-- 
Siemens AG, Technology
Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] x86/fpu: fix compile error without kernel_fpu_disabled()
  2022-05-24 14:46 jamienstar
@ 2022-05-26 16:19 ` Philippe Gerum
  2022-06-09  5:45   ` Jan Kiszka
  0 siblings, 1 reply; 7+ messages in thread
From: Philippe Gerum @ 2022-05-26 16:19 UTC (permalink / raw)
  To: jamienstar; +Cc: jan.kiszka, florian.bezdeka, xenomai


jamienstar@163.com writes:

> From: Jamie Huang <jamienstar@163.com>
>
> In v5.18-evl-rebase, function kernel_fpu_disabled() has been removed in
> commit 59f5ede3bc0f("x86/fpu: Prevent FPU state corruption"), so we will
> get compile error when CONFIG_DOVETAIL is enabled:
> arch/x86/kernel/fpu/core.c:931:6: error: implicit declaration of function ‘kernel_fpu_disabled’; did you mean ‘perf_pmu_disable’? [-Werror=implicit-function-declaration]
>     if (kernel_fpu_disabled()) {
>         ^~~~~~~~~~~~~~~~~~~
>         perf_pmu_disable
> cc1: all warnings being treated as errors
> So, fix it.
>
> Signed-off-by: Jamie Huang <jamienstar@163.com>
> ---
>  arch/x86/kernel/fpu/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
> index 6a0d1e7f278f..c3adbbb73226 100644
> --- a/arch/x86/kernel/fpu/core.c
> +++ b/arch/x86/kernel/fpu/core.c
> @@ -928,7 +928,7 @@ void fpu__suspend_inband(void)
>  	 * preemption of an inband kernel context currently using the
>  	 * fpu by a thread which resumes on the oob stage.
>  	 */
> -	if (kernel_fpu_disabled()) {
> +	if (this_cpu_read(in_kernel_fpu)) {
>  		save_fpregs_to_fpstate(kfpu);
>  		__cpu_invalidate_fpregs_state();
>  		oob_fpu_set_preempt(&tsk->thread.fpu);

Merged adding the same fixup to the comment nearby, thanks.

-- 
Philippe.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] x86/fpu: fix compile error without kernel_fpu_disabled()
@ 2022-05-24 14:46 jamienstar
  2022-05-26 16:19 ` Philippe Gerum
  0 siblings, 1 reply; 7+ messages in thread
From: jamienstar @ 2022-05-24 14:46 UTC (permalink / raw)
  To: rpm; +Cc: jamienstar, jan.kiszka, florian.bezdeka, xenomai

From: Jamie Huang <jamienstar@163.com>

In v5.18-evl-rebase, function kernel_fpu_disabled() has been removed in
commit 59f5ede3bc0f("x86/fpu: Prevent FPU state corruption"), so we will
get compile error when CONFIG_DOVETAIL is enabled:
arch/x86/kernel/fpu/core.c:931:6: error: implicit declaration of function ‘kernel_fpu_disabled’; did you mean ‘perf_pmu_disable’? [-Werror=implicit-function-declaration]
    if (kernel_fpu_disabled()) {
        ^~~~~~~~~~~~~~~~~~~
        perf_pmu_disable
cc1: all warnings being treated as errors
So, fix it.

Signed-off-by: Jamie Huang <jamienstar@163.com>
---
 arch/x86/kernel/fpu/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c
index 6a0d1e7f278f..c3adbbb73226 100644
--- a/arch/x86/kernel/fpu/core.c
+++ b/arch/x86/kernel/fpu/core.c
@@ -928,7 +928,7 @@ void fpu__suspend_inband(void)
 	 * preemption of an inband kernel context currently using the
 	 * fpu by a thread which resumes on the oob stage.
 	 */
-	if (kernel_fpu_disabled()) {
+	if (this_cpu_read(in_kernel_fpu)) {
 		save_fpregs_to_fpstate(kfpu);
 		__cpu_invalidate_fpregs_state();
 		oob_fpu_set_preempt(&tsk->thread.fpu);
-- 
2.17.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-06-09  8:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-16 15:32 [PATCH] x86/fpu: fix compile error without kernel_fpu_disabled() jamienstar
2022-05-16 15:59 ` Bezdeka, Florian
2022-05-24  6:39   ` Jan Kiszka
2022-05-24 14:46 jamienstar
2022-05-26 16:19 ` Philippe Gerum
2022-06-09  5:45   ` Jan Kiszka
2022-06-09  8:43     ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.