On Thu, Nov 24, 2022 at 1:55 AM David Woodhouse <dwmw2@xxxxxxxxxxxxx> wrote: > > On Thu, 2022-11-24 at 01:31 +0100, Paolo Bonzini wrote: > > Yet another possibility is to introduce a > > > > /* Copy from src to dest_ofs bytes into the combined area pointed to by > > * dest1 (up to dest1_len bytes) and dest2 (the rest). */ > > void split_memcpy(void *dest1, void *dest2, size_t dest_ofs, size_t > > dest1_len, void *src, size_t src_len) > > > > so that the on-stack struct is not needed at all. This makes it possible to > > avoid the rs_state hack as well. > > FWIW I did one of those in > https://lore.kernel.org/kvm/6acfdbd3e516ece5949e97c85e7db8dc97a3e6c6.camel@xxxxxxxxxxxxx/ > > Hated that too :) Aha, that may be where I got the idea. Won't win a beauty contest indeed. What if vx contained a struct vcpu_runstate_info instead of having separate fields? That might combine the best of the on-stack version and the best of the special-memcpy version... Going to bed now anyway. Paolo