All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: kvm: Annotate guest entry/exit as a single function
@ 2020-01-20 12:47 Mark Brown
  2020-01-20 16:45 ` Will Deacon
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2020-01-20 12:47 UTC (permalink / raw)
  To: James Morse, Julien Thierry, Suzuki K Poulose, Catalin Marinas,
	Will Deacon, Mark Rutland
  Cc: Mark Brown, linux-arm-kernel

In an effort to clarify and simplify the annotations of assembly
functions in the kernel new macros have been introduced replacing ENTRY
and ENDPROC. There are separate annotations SYM_FUNC_ for normal C
functions and SYM_CODE_ for other code. Currently __guest_enter and
__guest_exit are annotated as standard functions but this is not
entirely correct as the former doesn't do a normal return and the latter
is not entered in a normal fashion. From the point of view of the
hypervisor the guest entry/exit may be viewed as a single
function which happens to have an eret in the middle of it so let's
annotate it as such.

Suggested-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 arch/arm64/kvm/hyp/entry.S | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/arch/arm64/kvm/hyp/entry.S b/arch/arm64/kvm/hyp/entry.S
index e5cc8d66bf53..5b76a89939b1 100644
--- a/arch/arm64/kvm/hyp/entry.S
+++ b/arch/arm64/kvm/hyp/entry.S
@@ -44,7 +44,7 @@
  * u64 __guest_enter(struct kvm_vcpu *vcpu,
  *		     struct kvm_cpu_context *host_ctxt);
  */
-ENTRY(__guest_enter)
+SYM_FUNC_START(__guest_enter)
 	// x0: vcpu
 	// x1: host context
 	// x2-x17: clobbered by macros
@@ -96,9 +96,8 @@ alternative_else_nop_endif
 	// Do not touch any register after this!
 	eret
 	sb
-ENDPROC(__guest_enter)
 
-ENTRY(__guest_exit)
+SYM_INNER_LABEL(__guest_exit, SYM_L_GLOBAL)
 	// x0: return code
 	// x1: vcpu
 	// x2-x29,lr: vcpu regs
@@ -192,4 +191,4 @@ abort_guest_exit_end:
 	msr	spsr_el2, x4
 	orr	x0, x0, x5
 1:	ret
-ENDPROC(__guest_exit)
+SYM_FUNC_END(__guest_enter)
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: kvm: Annotate guest entry/exit as a single function
  2020-01-20 12:47 [PATCH] arm64: kvm: Annotate guest entry/exit as a single function Mark Brown
@ 2020-01-20 16:45 ` Will Deacon
  2020-01-20 16:58   ` Marc Zyngier
  2020-01-20 17:04   ` Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Will Deacon @ 2020-01-20 16:45 UTC (permalink / raw)
  To: Mark Brown, maz
  Cc: Mark Rutland, Suzuki K Poulose, Catalin Marinas, James Morse,
	Julien Thierry, linux-arm-kernel

[+Marc Z]

On Mon, Jan 20, 2020 at 12:47:06PM +0000, Mark Brown wrote:
> In an effort to clarify and simplify the annotations of assembly
> functions in the kernel new macros have been introduced replacing ENTRY
> and ENDPROC. There are separate annotations SYM_FUNC_ for normal C
> functions and SYM_CODE_ for other code. Currently __guest_enter and
> __guest_exit are annotated as standard functions but this is not
> entirely correct as the former doesn't do a normal return and the latter
> is not entered in a normal fashion. From the point of view of the
> hypervisor the guest entry/exit may be viewed as a single
> function which happens to have an eret in the middle of it so let's
> annotate it as such.
> 
> Suggested-by: Mark Rutland <mark.rutland@arm.com>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> ---
>  arch/arm64/kvm/hyp/entry.S | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm64/kvm/hyp/entry.S b/arch/arm64/kvm/hyp/entry.S
> index e5cc8d66bf53..5b76a89939b1 100644
> --- a/arch/arm64/kvm/hyp/entry.S
> +++ b/arch/arm64/kvm/hyp/entry.S
> @@ -44,7 +44,7 @@
>   * u64 __guest_enter(struct kvm_vcpu *vcpu,
>   *		     struct kvm_cpu_context *host_ctxt);
>   */
> -ENTRY(__guest_enter)
> +SYM_FUNC_START(__guest_enter)
>  	// x0: vcpu
>  	// x1: host context
>  	// x2-x17: clobbered by macros
> @@ -96,9 +96,8 @@ alternative_else_nop_endif
>  	// Do not touch any register after this!
>  	eret
>  	sb
> -ENDPROC(__guest_enter)
>  
> -ENTRY(__guest_exit)
> +SYM_INNER_LABEL(__guest_exit, SYM_L_GLOBAL)
>  	// x0: return code
>  	// x1: vcpu
>  	// x2-x29,lr: vcpu regs
> @@ -192,4 +191,4 @@ abort_guest_exit_end:
>  	msr	spsr_el2, x4
>  	orr	x0, x0, x5
>  1:	ret
> -ENDPROC(__guest_exit)
> +SYM_FUNC_END(__guest_enter)

I wondered what the INNER_LABEL thing was for! Looks good:

Acked-by: Will Deacon <will@kernel.org>

Assuming this is going via the kvm tree.

Will

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: kvm: Annotate guest entry/exit as a single function
  2020-01-20 16:45 ` Will Deacon
@ 2020-01-20 16:58   ` Marc Zyngier
  2020-01-20 17:04   ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Marc Zyngier @ 2020-01-20 16:58 UTC (permalink / raw)
  To: Will Deacon
  Cc: Mark Rutland, Suzuki K Poulose, Catalin Marinas, Mark Brown,
	James Morse, linux-arm-kernel, Julien Thierry

On 2020-01-20 16:45, Will Deacon wrote:
> [+Marc Z]

Thanks for the heads up!

> On Mon, Jan 20, 2020 at 12:47:06PM +0000, Mark Brown wrote:
>> In an effort to clarify and simplify the annotations of assembly
>> functions in the kernel new macros have been introduced replacing 
>> ENTRY
>> and ENDPROC. There are separate annotations SYM_FUNC_ for normal C
>> functions and SYM_CODE_ for other code. Currently __guest_enter and
>> __guest_exit are annotated as standard functions but this is not
>> entirely correct as the former doesn't do a normal return and the 
>> latter
>> is not entered in a normal fashion. From the point of view of the
>> hypervisor the guest entry/exit may be viewed as a single
>> function which happens to have an eret in the middle of it so let's
>> annotate it as such.
>> 
>> Suggested-by: Mark Rutland <mark.rutland@arm.com>
>> Signed-off-by: Mark Brown <broonie@kernel.org>
>> ---
>>  arch/arm64/kvm/hyp/entry.S | 7 +++----
>>  1 file changed, 3 insertions(+), 4 deletions(-)
>> 
>> diff --git a/arch/arm64/kvm/hyp/entry.S b/arch/arm64/kvm/hyp/entry.S
>> index e5cc8d66bf53..5b76a89939b1 100644
>> --- a/arch/arm64/kvm/hyp/entry.S
>> +++ b/arch/arm64/kvm/hyp/entry.S
>> @@ -44,7 +44,7 @@
>>   * u64 __guest_enter(struct kvm_vcpu *vcpu,
>>   *		     struct kvm_cpu_context *host_ctxt);
>>   */
>> -ENTRY(__guest_enter)
>> +SYM_FUNC_START(__guest_enter)
>>  	// x0: vcpu
>>  	// x1: host context
>>  	// x2-x17: clobbered by macros
>> @@ -96,9 +96,8 @@ alternative_else_nop_endif
>>  	// Do not touch any register after this!
>>  	eret
>>  	sb
>> -ENDPROC(__guest_enter)
>> 
>> -ENTRY(__guest_exit)
>> +SYM_INNER_LABEL(__guest_exit, SYM_L_GLOBAL)
>>  	// x0: return code
>>  	// x1: vcpu
>>  	// x2-x29,lr: vcpu regs
>> @@ -192,4 +191,4 @@ abort_guest_exit_end:
>>  	msr	spsr_el2, x4
>>  	orr	x0, x0, x5
>>  1:	ret
>> -ENDPROC(__guest_exit)
>> +SYM_FUNC_END(__guest_enter)
> 
> I wondered what the INNER_LABEL thing was for! Looks good:
> 
> Acked-by: Will Deacon <will@kernel.org>
> 
> Assuming this is going via the kvm tree.

Yup, I've now picked it up.

Thanks,

         M.
-- 
Jazz is not dead. It just smells funny...

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] arm64: kvm: Annotate guest entry/exit as a single function
  2020-01-20 16:45 ` Will Deacon
  2020-01-20 16:58   ` Marc Zyngier
@ 2020-01-20 17:04   ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2020-01-20 17:04 UTC (permalink / raw)
  To: Will Deacon
  Cc: Mark Rutland, Suzuki K Poulose, maz, James Morse,
	linux-arm-kernel, Catalin Marinas, Julien Thierry


[-- Attachment #1.1: Type: text/plain, Size: 203 bytes --]

On Mon, Jan 20, 2020 at 04:45:23PM +0000, Will Deacon wrote:
> [+Marc Z]

Ugh, sorry - guess there's some limit in my mind on the number of
recipients for a mail and KVM just has one too many reviewers!

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2020-01-20 17:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-20 12:47 [PATCH] arm64: kvm: Annotate guest entry/exit as a single function Mark Brown
2020-01-20 16:45 ` Will Deacon
2020-01-20 16:58   ` Marc Zyngier
2020-01-20 17:04   ` Mark Brown

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.