From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jJ6n6-0006r7-Ln for linux-um@lists.infradead.org; Tue, 31 Mar 2020 02:38:14 +0000 Received: by mail-pf1-x444.google.com with SMTP id k15so4478396pfh.6 for ; Mon, 30 Mar 2020 19:38:11 -0700 (PDT) Date: Tue, 31 Mar 2020 11:38:07 +0900 Message-ID: From: Hajime Tazaki Subject: Re: [RFC v4 23/25] um lkl: add UML network driver for lkl In-Reply-To: References: <0f087b36ad579eeb8062b12e9e61566d9b5b18ac.1585579244.git.thehajime@gmail.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-um" Errors-To: linux-um-bounces+geert=linux-m68k.org@lists.infradead.org To: johannes@sipsolutions.net Cc: tavi.purdila@gmail.com, linux-kernel-library@freelists.org, retrage01@gmail.com, linux-um@lists.infradead.org, linux-arch@vger.kernel.org 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 > > +#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 > > +#include > > +#include > > +#include > > +#include > > + > > + > > + > > +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 _______________________________________________ linux-um mailing list linux-um@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-um