All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Hagen Paul Pfeifer <hagen@jauu.net>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	David Miller <davem@davemloft.net>,
	netdev <netdev@vger.kernel.org>,
	Arnaldo Carvalho de Melo <acme@infradead.org>,
	Ben Hutchings <bhutchings@solarflare.com>
Subject: Re: [PATCH v2] net: filter: Just In Time compiler
Date: Thu, 14 Apr 2011 18:41:47 +0300	[thread overview]
Message-ID: <4DA715BB.6050307@redhat.com> (raw)
In-Reply-To: <0a7fdea6b816da546ea71f752d36b5c2@localhost>

On 04/14/2011 05:55 PM, Hagen Paul Pfeifer wrote:
> On Thu, 14 Apr 2011 17:40:03 +0300, Avi Kivity<avi@redhat.com>  wrote:
>
> >  Have you considered putting the compiler in userspace?
>
> Kernelspace (modules, threads, etc) can register BPF filters too. It is
> possible that there is no userspace involved at all.

A userspace jit would still work just fine, no?  I don't want the user 
who supplied the program to also supply the jit; rather, when the kernel 
installs the bpf program, it also asks an independent userspace compiler 
to translate it.

> >  The upside is that you can use established optimizing compilers like
> >  LLVM or GCC, which already support more target architectures.  It may
> >  not matter much for something simple like bpf, but other VMs may be a
> >  lot more complicated.
>
> BPF is another domain. Standard compiler optimization are not comparable
> to BPF optimizations so there is no gain there. Maybe writing a gcc front
> _and_ back-end may gain some valuable advantages.

I'm talking about optimizing the generated code.  For example, bpf has 
just two registers so a complex program generates a lot of loads and 
stores.  An optimizing compiler can use extra target registers to avoid 
those spills, and doesn't need to keep A and X in fixed registers.

If you translate the bpf program to C and optimize that with gcc you'll 
probably get much better machine code that the jit in the patch.

-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2011-04-14 15:42 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-02 22:28 [PATCH v1] net: filter: Just In Time compiler Eric Dumazet
2011-04-02 22:50 ` Hagen Paul Pfeifer
2011-04-03  5:41   ` Eric Dumazet
2011-04-02 22:53 ` Ben Hutchings
2011-04-03 13:56   ` [PATCH v2] " Eric Dumazet
2011-04-04  5:07     ` David Miller
2011-04-04  5:21       ` Eric Dumazet
2011-04-14 14:40     ` Avi Kivity
2011-04-14 14:55       ` Hagen Paul Pfeifer
2011-04-14 15:41         ` Avi Kivity [this message]
2011-04-14 15:45           ` Eric Dumazet
2011-04-14 15:53             ` Avi Kivity
2011-04-14 16:05               ` Eric Dumazet
2011-04-20  7:41                 ` Avi Kivity
2011-04-20  8:07                   ` Eric Dumazet
2011-04-20  8:14                     ` David Miller
2011-04-20  8:27                       ` Hagen Paul Pfeifer
2011-04-20 19:27                       ` Eric Dumazet
2011-04-28  6:05                         ` David Miller
2011-04-20  8:12                   ` David Miller
2011-04-14 15:40       ` Eric Dumazet
2011-04-14 15:45         ` Avi Kivity
2011-04-03  5:43 ` [PATCH v1] " David Miller
2011-04-03  9:04   ` Eric Dumazet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DA715BB.6050307@redhat.com \
    --to=avi@redhat.com \
    --cc=acme@infradead.org \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=hagen@jauu.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.