On 31.07.2025 17:16, Dmytro Prokopchuk1 wrote:
> --- a/xen/arch/arm/guestcopy.c
> +++ b/xen/arch/arm/guestcopy.c
> @@ -109,27 +109,31 @@ static unsigned long copy_guest(void *buf, uint64_t 
> addr, unsigned int len,
>  
>  unsigned long raw_copy_to_guest(void *to, const void *from, unsigned int len)
>  {
> +    struct vcpu *current_vcpu = current;

The commonly used name for this kind of variable is curr. Also wherever
you introduce one anew, it would preferably be pointer-to-const when
possible. (This isn't a request to rename or re-type existing variables
right here.)

> @@ -1899,6 +1899,7 @@ typedef long ret_t;
>  ret_t do_sched_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>  {
>      ret_t ret = 0;
> +    struct vcpu *v = current;

I wonder if this wasn't better introduced in the two scopes that actually
need it.

> @@ -1922,8 +1923,8 @@ ret_t do_sched_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) 
> arg)
>          if ( copy_from_guest(&sched_shutdown, arg, 1) )
>              break;
>  
> -        TRACE_TIME(TRC_SCHED_SHUTDOWN, current->domain->domain_id,
> -                   current->vcpu_id, sched_shutdown.reason);
> +        TRACE_TIME(TRC_SCHED_SHUTDOWN, v->domain->domain_id,
> +                   v->vcpu_id, sched_shutdown.reason);
>          ret = domain_shutdown(current->domain, (u8)sched_shutdown.reason);
>  
>          break;
> @@ -1938,7 +1939,7 @@ ret_t do_sched_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) 
> arg)
>          if ( copy_from_guest(&sched_shutdown, arg, 1) )
>              break;
>  
> -        TRACE_TIME(TRC_SCHED_SHUTDOWN_CODE, d->domain_id, current->vcpu_id,
> +        TRACE_TIME(TRC_SCHED_SHUTDOWN_CODE, d->domain_id, v->vcpu_id,
>                     sched_shutdown.reason);

A few lines up from here there's another use of current that you then
would also want to replace by curr.

Jan

Reply via email to