Re: [PATCH] xen/x86: fix PV trap handling on secondary processors

From: Boris Ostrovsky
Date: Thu Sep 16 2021 - 21:35:03 EST



On 9/16/21 11:04 AM, Jan Beulich wrote:
> {
> const struct desc_ptr *desc = this_cpu_ptr(&idt_desc);
> + unsigned i, count = (desc->size + 1) / sizeof(gate_desc);
>
> - xen_convert_trap_info(desc, traps);


Can you instead add a boolean parameter to xen_convert_trap_info() to indicate whether to skip empty entries? That will avoid (almost) duplicating the code.


-boris


> + BUG_ON(count > 256);
> +
> + for (i = 0; i < count; ++i) {
> + const gate_desc *entry = (gate_desc *)desc->address + i;
> +
> + cvt_gate_to_trap(i, entry, &traps[i]);
> + }
> }
>
> /* Load a new IDT into Xen. In principle this can be per-CPU, so we
>