Re: [RFC v4 23/25] um lkl: add UML network driver for lkl

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

 



Thanks for the comments, Johannes.

On Tue, 31 Mar 2020 06:31:15 +0900,
Johannes Berg wrote:
> 
> 
> > +++ b/arch/um/lkl/include/asm/irq.h
> > @@ -2,6 +2,9 @@
> >  #ifndef _ASM_LKL_IRQ_H
> >  #define _ASM_LKL_IRQ_H
> >  
> > +/* pull UML's definitions */
> > +#include "../../../include/asm/irq.h"
> 
> This is _really_ ugly.

Hmm, in previous patchset (until v3), I was using the worse approach
(I thought) to avoid this include.

+KBUILD_CFLAGS  += -DTIMER_IRQ=0 -DUBD_IRQ=4 -DUM_ETH_IRQ=5 -DLAST_IRQ=15

And I thought the current way is better than before.


> > +#if defined(__linux) && (defined(__i386) || defined(__x86_64))
> > +#include <os.h>
> > +#endif
> > +void *um_os_signal(int signum, void *handler);
> 
> and arguably those random declarations you're sprinkling are worse.

It means that those are only used when UML drivers (net, block) are
enabled, which are only available on Intel/linux hosts.  OTOH,
UMMODE_LIB _will_ support non-Intel/Linux hosts in the future thus,
this ifdefs exist.

> > @@ -181,6 +196,11 @@ void init_IRQ(void)
> >  	for (i = 0; i < NR_IRQS; i++)
> >  		irq_set_chip_and_handler(i, &dummy_irq_chip, handle_simple_irq);
> >  
> > +#if defined(__linux) && (defined(__i386) || defined(__x86_64))
> 
> What's with all those ifdefs with this condition?

Same as above.
but I agree that the ifdefs are cryptic; I'll try to make it more
understandable if I use ifdefs.

> > +++ b/tools/lkl/lib/um/um_glue.c
> > @@ -0,0 +1,39 @@
> > +// SPDX-License-Identifier: GPL-2.0
> > +#include <stdio.h>
> > +#include <stdlib.h>
> > +#include <string.h>
> > +#include <unistd.h>
> > +#include <errno.h>
> > +
> > +
> > +
> > +char lkl_um_devs[4096];
> > +
> > +/* from sigio.c */
> > +void maybe_sigio_broken(int fd, int read)
> > +{
> > +}
> > +
> > +/* from process.c */
> > +int os_getpid(void)
> > +{
> > +	return getpid();
> > +}
> 
> All of this really is quite ugly - are you sure it's needed for just the
> vector network driver??

Those are needed when we use UML_NET or BLK_DEV_UBD is enabled.  I was
trying to minimize those glue code as much as possible; I need another
try to check if we can remove more or eliminate completely by other
ways.

-- Hajime



[Index of Archives]     [Linux Kernel]     [Kernel Newbies]     [x86 Platform Driver]     [Netdev]     [Linux Wireless]     [Netfilter]     [Bugtraq]     [Linux Filesystems]     [Yosemite Discussion]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux