Re: [PATCH 4/8] KVM: selftests: Copy printf.c to KVM selftests

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 18, 2023 at 08:03:53AM -0700, Sean Christopherson wrote:
> On Mon, Apr 17, 2023, Aaron Lewis wrote:
> > On Thu, Mar 23, 2023, Sean Christopherson wrote:
> > > > +static char *number(char *str, long num, int base, int size, int precision,
> > > > +		    int type)
> > > 
> > > Do we actually need a custom number()?  I.e. can we sub in a libc equivalent?
> > > That would reduce the craziness of this file by more than a few degrees.
> > 
> > Yeah, I think we need it.  One of the biggest problems I'm trying to avoid
> > here is the use of LIBC in a guest.  Using it always seems to end poorly
> > because guests generally don't set up AVX-512 or a TLS segmet, nor should
> > they have to.  Calling into LIBC seems to require both of them too often,
> > so it seems like it's better to just avoid it.
> 
> True, we'd probably end up in a world of hurt.
> 
> I was going to suggest copy+pasting from a different source, e.g. musl, in the
> hopes of reducing the crazy by a degree, but after looking at the musl source,
> that's a terrible idea :-)
> 
> And copying from the kernel has the advantage of keeping any bugs/quirks that
> users may be expecting and/or relying on.

What about trying to use tools/include/nolibc/? Maybe we could provide our
own tools/include/nolibc/arch-*.h files where the my_syscall* macros get
implemented with ucalls, and then the ucalls would implement the syscalls,
possibly just forwarding the parameters to real syscalls. We can implement
copy_from/to_guest() functions to deal with pointer parameters.

Thanks,
drew



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux