On 31.07.25 17:32, Jan Beulich wrote:
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.

I'd be in favor of keeping it in function scope, but with replacing all
references of "current" in this function with "v". Doing the same in
vcpu_yield() shows the following code reductions:

bloat-o-meter core-orig.o core.o
add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-160 (-160)
Function                                     old     new   delta
vcpu_yield                                   455     449      -6
do_sched_op                                 1216    1139     -77
compat_sched_op                             1211    1134     -77
Total: Before=36174, After=36014, chg -0.44%

Dmytro, with Andrew's response regarding the Misra "violation" with "current",
its up to you whether you want to send another patch for common/sched/core.c.

In case you don't want to do that, please tell me and I'll send that patch.


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to