All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <levinsasha928@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: penberg@kernel.org, kvm@vger.kernel.org, asias.hejun@gmail.com,
	gorcunov@gmail.com, prasadjoshi124@gmail.com
Subject: Re: [PATCH 2/3 V2] kvm tools: Add support for multiple virtio-blk
Date: Wed, 04 May 2011 17:44:28 +0300	[thread overview]
Message-ID: <1304520268.22299.6.camel@lappy> (raw)
In-Reply-To: <20110504135616.GA11941@elte.hu>

On Wed, 2011-05-04 at 15:56 +0200, Ingo Molnar wrote:
> * Sasha Levin <levinsasha928@gmail.com> wrote:
> 
> > Add support for multiple blk_devices by un-globalizing
> > the current blk_device and allow multiple blk_devices.
> 
> Very nice!
> 
> One nit:
> 
> > +	mpc_intsrc		= last_addr;
> > +	mpc_intsrc->type	= MP_INTSRC;
> > +	mpc_intsrc->irqtype	= mp_INT;
> > +	mpc_intsrc->irqflag	= MP_IRQDIR_DEFAULT;
> > +	mpc_intsrc->srcbus	= pcibusid;
> > +	mpc_intsrc->srcbusirq	= 1; /* virtio block irq pin */
> > +	mpc_intsrc->dstapic	= ioapicid;
> > +	mpc_intsrc->dstirq	= 10; /* VIRTIO_BLK_IRQ */
> > +
> > +	last_addr = (void *)&mpc_intsrc[1];
> > +	nentries++;
> > +
> > +	mpc_intsrc		= last_addr;
> > +	mpc_intsrc->type	= MP_INTSRC;
> > +	mpc_intsrc->irqtype	= mp_INT;
> > +	mpc_intsrc->irqflag	= MP_IRQDIR_DEFAULT;
> > +	mpc_intsrc->srcbus	= pcibusid;
> > +	mpc_intsrc->srcbusirq	= 1; /* virtio block irq pin */
> > +	mpc_intsrc->dstapic	= ioapicid;
> > +	mpc_intsrc->dstirq	= 11; /* VIRTIO_BLK_IRQ */
> > +
> > +	last_addr = (void *)&mpc_intsrc[1];
> > +	nentries++;
> > +
> > +	mpc_intsrc		= last_addr;
> > +	mpc_intsrc->type	= MP_INTSRC;
> > +	mpc_intsrc->irqtype	= mp_INT;
> > +	mpc_intsrc->irqflag	= MP_IRQDIR_DEFAULT;
> > +	mpc_intsrc->srcbus	= pcibusid;
> > +	mpc_intsrc->srcbusirq	= 1; /* virtio block irq pin */
> > +	mpc_intsrc->dstapic	= ioapicid;
> > +	mpc_intsrc->dstirq	= 12; /* VIRTIO_BLK_IRQ */
> 
> There should really be a helper function for these initializations - and a loop 
> that creates VIRTIO_BLK_MAX_DEV of them, right?
> 
> Also, the IRQs used by kvm should be enumerated in an include file in a single 
> place, with ranges allocated for specific purposes, otherwise we'll quickly 
> lose track of them.
> 

The plan is that mptable.c is going to change either way, Cyrill noted
we need a way to manage IRQs earlier in that file. That's also why I
tried not changing it too much.

> And a pet peeve of mine:
> 
> > +struct blk_device_job {
> > +	struct virt_queue	*vq;
> > +	struct blk_device	*blk_device;
> > +	void			*job_id;
> > +};
> > +
> >  struct blk_device {
> >  	pthread_mutex_t			mutex;
> >  
> >  	struct virtio_blk_config	blk_config;
> > -	struct disk_image			*disk;
> > +	struct disk_image		*disk;
> >  	uint32_t			host_features;
> >  	uint32_t			guest_features;
> >  	uint16_t			config_vector;
> >  	uint8_t				status;
> > +	u8				idx;
> 
> The vertical spacing of those two structures (blk_device_job and blk_device) is 
> inconsistent.
> 
Will fix.

> >  static bool virtio_blk_pci_io_in(struct kvm *self, uint16_t port, void *data, int size, uint32_t count)
> >  {
> > -	unsigned long offset;
> > +	u16 offset, dev_idx;
> >  	bool ret = true;
> > +	struct blk_device *blk_device;
> 
> Suggestion: please standardize on shorter but still obvious variable names. For 
> blk_device a good one could be 'bdev'.
> 
> Given how frequently it's used you might even abbreviate 'struct blk_device' to 
> 'struct blk_dev' - even in that shortr form it's still very obvious what it 
> means.
> 
> The new, standardized and streamlined naming convention should be propagated to 
> all 'struct blk_device' using functions. (in separate patches)

Will fix.

-- 

Sasha.


  parent reply	other threads:[~2011-05-04 14:44 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-04 13:45 [PATCH 0/3 V2] kvm tools: Support for multiple virtio-blk Sasha Levin
2011-05-04 13:45 ` [PATCH 1/3 V2] kvm tools: Move disk_image into virtio-blk Sasha Levin
2011-05-04 13:45 ` [PATCH 2/3 V2] kvm tools: Add support for multiple virtio-blk Sasha Levin
2011-05-04 13:56   ` Ingo Molnar
2011-05-04 14:32     ` Avi Kivity
2011-05-04 14:40       ` Asias He
2011-05-04 14:44     ` Sasha Levin [this message]
2011-05-04 14:51       ` Cyrill Gorcunov
2011-05-04 13:45 ` [PATCH 3/3 V2] kvm tools: Add cmdline options for loading multiple images Sasha Levin
2011-05-04 14:51   ` David Ahern
2011-05-04 15:03     ` Sasha Levin
2011-05-04 15:33       ` David Ahern
2011-05-04 19:38         ` Sasha Levin

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=1304520268.22299.6.camel@lappy \
    --to=levinsasha928@gmail.com \
    --cc=asias.hejun@gmail.com \
    --cc=gorcunov@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=penberg@kernel.org \
    --cc=prasadjoshi124@gmail.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 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.