qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@gmail.com>
To: Dmitry Fleytman <dmitry@daynix.com>
Cc: Alexander Graf <agraf@suse.de>,
	qemu-devel <qemu-devel@nongnu.org>,
	Yan Vugenfirer <yan@daynix.com>,
	Anthony Liguori <anthony@codemonkey.ws>,
	Gerhard Wiesinger <lists@wiesinger.com>,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH V14 5/5] VMXNET3 device implementation
Date: Thu, 28 Mar 2013 10:09:52 +0100	[thread overview]
Message-ID: <20130328090952.GA24580@stefanha-thinkpad.redhat.com> (raw)
In-Reply-To: <CAGHCxhe4yX7KEuO-SJTpzwx9K5JEsmwgWYAexVrHUViWPsysHw@mail.gmail.com>

On Wed, Mar 27, 2013 at 06:36:59PM +0200, Dmitry Fleytman wrote:
> On Wed, Mar 27, 2013 at 6:06 PM, Alexander Graf <agraf@suse.de> 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	other threads:[~2013-03-28  9:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-09  9:21 [Qemu-devel] [PATCH V14 0/5] VMXNET3 paravirtual NIC device implementation Dmitry Fleytman
2013-03-09  9:21 ` [Qemu-devel] [PATCH V14 1/5] Checksum-related utility functions Dmitry Fleytman
2013-03-09  9:21 ` [Qemu-devel] [PATCH V14 2/5] net: iovec checksum calculator Dmitry Fleytman
2013-03-09  9:21 ` [Qemu-devel] [PATCH V14 3/5] Common definitions for VMWARE devices Dmitry Fleytman
2013-03-09  9:21 ` [Qemu-devel] [PATCH V14 4/5] Packet abstraction for VMWARE network devices Dmitry Fleytman
2013-03-09  9:21 ` [Qemu-devel] [PATCH V14 5/5] VMXNET3 device implementation Dmitry Fleytman
2013-03-27 14:49   ` Alexander Graf
2013-03-27 15:46     ` Paolo Bonzini
2013-03-27 16:06       ` Alexander Graf
2013-03-27 16:36         ` Dmitry Fleytman
2013-03-28  9:09           ` Stefan Hajnoczi [this message]
2013-03-12  9:38 ` [Qemu-devel] [PATCH V14 0/5] VMXNET3 paravirtual NIC " Stefan Hajnoczi

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=20130328090952.GA24580@stefanha-thinkpad.redhat.com \
    --to=stefanha@gmail.com \
    --cc=agraf@suse.de \
    --cc=anthony@codemonkey.ws \
    --cc=dmitry@daynix.com \
    --cc=lists@wiesinger.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=yan@daynix.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).