qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH V14 5/5] VMXNET3 device implementation


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [PATCH V14 5/5] VMXNET3 device implementation
Date: Thu, 28 Mar 2013 10:09:52 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, Mar 27, 2013 at 06:36:59PM +0200, Dmitry Fleytman wrote:
> On Wed, Mar 27, 2013 at 6:06 PM, Alexander Graf <address@hidden> wrote:
> 
> >
> > On 27.03.2013, at 16:46, Paolo Bonzini wrote:
> >
> > > Il 27/03/2013 15:49, Alexander Graf ha scritto:
> > >>>> +#if defined(HOST_WORDS_BIGENDIAN)
> > >>>> +#define const_cpu_to_le64(x) bswap_64(x)
> > >>>> +#define __BIG_ENDIAN_BITFIELD
> > >> Ah, sorry, I replied to the wrong version.
> > >>
> > >> ARE YOU KIDDING ME? BIG ENDIAN BITFIELD? BITFIELDS ARE _IMPLEMENTATION
> > SPECIFIC_!
> > >>
> > >> Can we please revert this whole patch set and send the authors back to
> > school?
> > >
> > > Can we please maintain a decent tone?
> > >
> > > First, this file comes from Linux.  __BIG_ENDIAN_BITFIELD is a Linux
> > > #define.  No doubt it is wrong to define it based on
> > > HOST_WORDS_BIGENDIAN, it is better to use a configure check.  But it's
> > > not the reason why PPC compilation fails.
> >
> > No, but it indicates that the code isn't written with portability in mind.
> >
> > It's simply wrong to define it in the first place. You shouldn't do any
> > assumptions how bitfields are laid out in memory / registers. Linux gets
> > away with it mostly because it's heavily tied to gcc, but we shouldn't take
> > the same assumptions in QEMU code.
> >
> 
> First of all I'd like to emphasize that vmxnet3 and pvscsi patches are our
> first experience in writing QEMU devices so most probably we miss some
> common practices of the project.
> The codebase is huge and it takes time to learn things like this.
> At the same time we are open for constructive criticism and ready to
> improve the code we submit.
> 
> Regarding this specific case, we used an approach from current QEMU code,
> namely bitfield definitions technique from slirp/ip.h and slirp/tcp.h files.
> We do realize this is not the best way, if there are examples of better
> techniques in QEMU codebase please point it out.

It may not be obvious since it's part of the source tree but slirp is
not a good example of QEMU code.  It actually comes from
http://slirp.sourceforge.net/.

Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]