Re: [virtio-dev] Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-24 Thread Wei Wang
On 01/24/2018 12:29 PM, Michael S. Tsirkin wrote: On Mon, Jan 22, 2018 at 07:25:45PM +0800, Wei Wang wrote: On 01/19/2018 08:39 PM, Michael S. Tsirkin wrote: On Fri, Jan 19, 2018 at 11:44:21AM +0800, Wei Wang wrote: On 01/18/2018 12:44 AM, Michael S. Tsirkin wrote: On Wed, Jan 17, 2018 at

Re: [virtio-dev] Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-24 Thread Wei Wang
On 01/24/2018 12:29 PM, Michael S. Tsirkin wrote: On Mon, Jan 22, 2018 at 07:25:45PM +0800, Wei Wang wrote: On 01/19/2018 08:39 PM, Michael S. Tsirkin wrote: On Fri, Jan 19, 2018 at 11:44:21AM +0800, Wei Wang wrote: On 01/18/2018 12:44 AM, Michael S. Tsirkin wrote: On Wed, Jan 17, 2018 at

Re: [virtio-dev] Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-23 Thread Michael S. Tsirkin
On Wed, Jan 24, 2018 at 11:18:40AM +0800, Wei Wang wrote: > On 01/22/2018 07:25 PM, Wei Wang wrote: > > On 01/19/2018 08:39 PM, Michael S. Tsirkin wrote: > > > On Fri, Jan 19, 2018 at 11:44:21AM +0800, Wei Wang wrote: > > > > On 01/18/2018 12:44 AM, Michael S. Tsirkin wrote: > > > > > On Wed, Jan

Re: [virtio-dev] Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-23 Thread Michael S. Tsirkin
On Wed, Jan 24, 2018 at 11:18:40AM +0800, Wei Wang wrote: > On 01/22/2018 07:25 PM, Wei Wang wrote: > > On 01/19/2018 08:39 PM, Michael S. Tsirkin wrote: > > > On Fri, Jan 19, 2018 at 11:44:21AM +0800, Wei Wang wrote: > > > > On 01/18/2018 12:44 AM, Michael S. Tsirkin wrote: > > > > > On Wed, Jan

Re: [virtio-dev] Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-23 Thread Michael S. Tsirkin
On Mon, Jan 22, 2018 at 07:25:45PM +0800, Wei Wang wrote: > On 01/19/2018 08:39 PM, Michael S. Tsirkin wrote: > > On Fri, Jan 19, 2018 at 11:44:21AM +0800, Wei Wang wrote: > > > On 01/18/2018 12:44 AM, Michael S. Tsirkin wrote: > > > > On Wed, Jan 17, 2018 at 01:10:11PM +0800, Wei Wang wrote: > >

Re: [virtio-dev] Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-23 Thread Michael S. Tsirkin
On Mon, Jan 22, 2018 at 07:25:45PM +0800, Wei Wang wrote: > On 01/19/2018 08:39 PM, Michael S. Tsirkin wrote: > > On Fri, Jan 19, 2018 at 11:44:21AM +0800, Wei Wang wrote: > > > On 01/18/2018 12:44 AM, Michael S. Tsirkin wrote: > > > > On Wed, Jan 17, 2018 at 01:10:11PM +0800, Wei Wang wrote: > >

Re: [virtio-dev] Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-23 Thread Wei Wang
On 01/22/2018 07:25 PM, Wei Wang wrote: On 01/19/2018 08:39 PM, Michael S. Tsirkin wrote: On Fri, Jan 19, 2018 at 11:44:21AM +0800, Wei Wang wrote: On 01/18/2018 12:44 AM, Michael S. Tsirkin wrote: On Wed, Jan 17, 2018 at 01:10:11PM +0800, Wei Wang wrote: +vb->start_cmd_id = cmd_id;

Re: [virtio-dev] Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-23 Thread Wei Wang
On 01/22/2018 07:25 PM, Wei Wang wrote: On 01/19/2018 08:39 PM, Michael S. Tsirkin wrote: On Fri, Jan 19, 2018 at 11:44:21AM +0800, Wei Wang wrote: On 01/18/2018 12:44 AM, Michael S. Tsirkin wrote: On Wed, Jan 17, 2018 at 01:10:11PM +0800, Wei Wang wrote: +vb->start_cmd_id = cmd_id;

Re: [virtio-dev] Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-22 Thread Wei Wang
On 01/19/2018 08:39 PM, Michael S. Tsirkin wrote: On Fri, Jan 19, 2018 at 11:44:21AM +0800, Wei Wang wrote: On 01/18/2018 12:44 AM, Michael S. Tsirkin wrote: On Wed, Jan 17, 2018 at 01:10:11PM +0800, Wei Wang wrote: + vb->start_cmd_id = cmd_id; +

Re: [virtio-dev] Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-22 Thread Wei Wang
On 01/19/2018 08:39 PM, Michael S. Tsirkin wrote: On Fri, Jan 19, 2018 at 11:44:21AM +0800, Wei Wang wrote: On 01/18/2018 12:44 AM, Michael S. Tsirkin wrote: On Wed, Jan 17, 2018 at 01:10:11PM +0800, Wei Wang wrote: + vb->start_cmd_id = cmd_id; +

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-20 Thread Tetsuo Handa
Michael S. Tsirkin wrote: > > > > >> + * the page if the vq is full. We are adding one entry each > > > > >> time, > > > > >> + * which essentially results in no memory allocation, so the > > > > >> + * GFP_KERNEL flag below can be ignored. > > > > >> + */ > > > > >> +if

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-20 Thread Tetsuo Handa
Michael S. Tsirkin wrote: > > > > >> + * the page if the vq is full. We are adding one entry each > > > > >> time, > > > > >> + * which essentially results in no memory allocation, so the > > > > >> + * GFP_KERNEL flag below can be ignored. > > > > >> + */ > > > > >> +if

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-19 Thread Michael S. Tsirkin
On Fri, Jan 19, 2018 at 11:44:21AM +0800, Wei Wang wrote: > On 01/18/2018 12:44 AM, Michael S. Tsirkin wrote: > > On Wed, Jan 17, 2018 at 01:10:11PM +0800, Wei Wang wrote: > > > > > > > > +{ > > > + struct scatterlist sg; > > > + unsigned int unused; > > > + int err; > > > + > > > +

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-19 Thread Michael S. Tsirkin
On Fri, Jan 19, 2018 at 11:44:21AM +0800, Wei Wang wrote: > On 01/18/2018 12:44 AM, Michael S. Tsirkin wrote: > > On Wed, Jan 17, 2018 at 01:10:11PM +0800, Wei Wang wrote: > > > > > > > > +{ > > > + struct scatterlist sg; > > > + unsigned int unused; > > > + int err; > > > + > > > +

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-18 Thread Wei Wang
On 01/18/2018 12:44 AM, Michael S. Tsirkin wrote: On Wed, Jan 17, 2018 at 01:10:11PM +0800, Wei Wang wrote: +static void virtballoon_changed(struct virtio_device *vdev) +{ + struct virtio_balloon *vb = vdev->priv; + unsigned long flags; + __u32 cmd_id; + s64 diff =

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-18 Thread Wei Wang
On 01/18/2018 12:44 AM, Michael S. Tsirkin wrote: On Wed, Jan 17, 2018 at 01:10:11PM +0800, Wei Wang wrote: +static void virtballoon_changed(struct virtio_device *vdev) +{ + struct virtio_balloon *vb = vdev->priv; + unsigned long flags; + __u32 cmd_id; + s64 diff =

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-18 Thread Wei Wang
On 01/18/2018 12:44 AM, Michael S. Tsirkin wrote: On Wed, Jan 17, 2018 at 01:10:11PM +0800, Wei Wang wrote: +{ + struct scatterlist sg; + unsigned int unused; + int err; + + sg_init_one(, addr, sizeof(uint32_t)); This passes a guest-endian value to host. This is a

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-18 Thread Wei Wang
On 01/18/2018 12:44 AM, Michael S. Tsirkin wrote: On Wed, Jan 17, 2018 at 01:10:11PM +0800, Wei Wang wrote: +{ + struct scatterlist sg; + unsigned int unused; + int err; + + sg_init_one(, addr, sizeof(uint32_t)); This passes a guest-endian value to host. This is a

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-18 Thread Michael S. Tsirkin
On Fri, Jan 19, 2018 at 06:11:31AM +0900, Tetsuo Handa wrote: > Michael S. Tsirkin wrote: > > On Thu, Jan 18, 2018 at 10:30:18PM +0900, Tetsuo Handa wrote: > > > On 2018/01/18 1:44, Michael S. Tsirkin wrote: > > > >> +static void add_one_sg(struct virtqueue *vq, unsigned long pfn, > > > >>

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-18 Thread Michael S. Tsirkin
On Fri, Jan 19, 2018 at 06:11:31AM +0900, Tetsuo Handa wrote: > Michael S. Tsirkin wrote: > > On Thu, Jan 18, 2018 at 10:30:18PM +0900, Tetsuo Handa wrote: > > > On 2018/01/18 1:44, Michael S. Tsirkin wrote: > > > >> +static void add_one_sg(struct virtqueue *vq, unsigned long pfn, > > > >>

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-18 Thread Tetsuo Handa
Michael S. Tsirkin wrote: > On Thu, Jan 18, 2018 at 10:30:18PM +0900, Tetsuo Handa wrote: > > On 2018/01/18 1:44, Michael S. Tsirkin wrote: > > >> +static void add_one_sg(struct virtqueue *vq, unsigned long pfn, > > >> uint32_t len) > > >> +{ > > >> +struct scatterlist sg; > > >> +

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-18 Thread Tetsuo Handa
Michael S. Tsirkin wrote: > On Thu, Jan 18, 2018 at 10:30:18PM +0900, Tetsuo Handa wrote: > > On 2018/01/18 1:44, Michael S. Tsirkin wrote: > > >> +static void add_one_sg(struct virtqueue *vq, unsigned long pfn, > > >> uint32_t len) > > >> +{ > > >> +struct scatterlist sg; > > >> +

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-18 Thread Michael S. Tsirkin
On Thu, Jan 18, 2018 at 10:30:18PM +0900, Tetsuo Handa wrote: > On 2018/01/18 1:44, Michael S. Tsirkin wrote: > >> +static void add_one_sg(struct virtqueue *vq, unsigned long pfn, uint32_t > >> len) > >> +{ > >> + struct scatterlist sg; > >> + unsigned int unused; > >> + int err; > >> + > >> +

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-18 Thread Michael S. Tsirkin
On Thu, Jan 18, 2018 at 10:30:18PM +0900, Tetsuo Handa wrote: > On 2018/01/18 1:44, Michael S. Tsirkin wrote: > >> +static void add_one_sg(struct virtqueue *vq, unsigned long pfn, uint32_t > >> len) > >> +{ > >> + struct scatterlist sg; > >> + unsigned int unused; > >> + int err; > >> + > >> +

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-18 Thread Tetsuo Handa
On 2018/01/18 1:44, Michael S. Tsirkin wrote: >> +static void add_one_sg(struct virtqueue *vq, unsigned long pfn, uint32_t >> len) >> +{ >> +struct scatterlist sg; >> +unsigned int unused; >> +int err; >> + >> +sg_init_table(, 1); >> +sg_set_page(, pfn_to_page(pfn), len, 0);

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-18 Thread Tetsuo Handa
On 2018/01/18 1:44, Michael S. Tsirkin wrote: >> +static void add_one_sg(struct virtqueue *vq, unsigned long pfn, uint32_t >> len) >> +{ >> +struct scatterlist sg; >> +unsigned int unused; >> +int err; >> + >> +sg_init_table(, 1); >> +sg_set_page(, pfn_to_page(pfn), len, 0);

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-17 Thread Michael S. Tsirkin
On Wed, Jan 17, 2018 at 01:10:11PM +0800, Wei Wang wrote: > Negotiation of the VIRTIO_BALLOON_F_FREE_PAGE_VQ feature indicates the > support of reporting hints of guest free pages to host via virtio-balloon. > > Host requests the guest to report free pages by sending a new cmd > id to the guest

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-17 Thread Michael S. Tsirkin
On Wed, Jan 17, 2018 at 01:10:11PM +0800, Wei Wang wrote: > Negotiation of the VIRTIO_BALLOON_F_FREE_PAGE_VQ feature indicates the > support of reporting hints of guest free pages to host via virtio-balloon. > > Host requests the guest to report free pages by sending a new cmd > id to the guest

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-17 Thread Wei Wang
On 01/17/2018 05:27 PM, Pankaj Gupta wrote: On 01/17/2018 04:21 PM, Pankaj Gupta wrote: o.k you have initialize "err = -ENOMEM;" Remove these four lines. -kfree(names); -kfree(callbacks); -kfree(vqs); -return 0; +err = 0; //

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-17 Thread Wei Wang
On 01/17/2018 05:27 PM, Pankaj Gupta wrote: On 01/17/2018 04:21 PM, Pankaj Gupta wrote: o.k you have initialize "err = -ENOMEM;" Remove these four lines. -kfree(names); -kfree(callbacks); -kfree(vqs); -return 0; +err = 0; //

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-17 Thread Pankaj Gupta
> On 01/17/2018 04:21 PM, Pankaj Gupta wrote: > >> Negotiation of the VIRTIO_BALLOON_F_FREE_PAGE_VQ feature indicates the > >> support of reporting hints of guest free pages to host via virtio-balloon. > >> > >> Host requests the guest to report free pages by sending a new cmd > >> id to the

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-17 Thread Pankaj Gupta
> On 01/17/2018 04:21 PM, Pankaj Gupta wrote: > >> Negotiation of the VIRTIO_BALLOON_F_FREE_PAGE_VQ feature indicates the > >> support of reporting hints of guest free pages to host via virtio-balloon. > >> > >> Host requests the guest to report free pages by sending a new cmd > >> id to the

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-17 Thread Wei Wang
On 01/17/2018 04:21 PM, Pankaj Gupta wrote: Negotiation of the VIRTIO_BALLOON_F_FREE_PAGE_VQ feature indicates the support of reporting hints of guest free pages to host via virtio-balloon. Host requests the guest to report free pages by sending a new cmd id to the guest via the

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-17 Thread Wei Wang
On 01/17/2018 04:21 PM, Pankaj Gupta wrote: Negotiation of the VIRTIO_BALLOON_F_FREE_PAGE_VQ feature indicates the support of reporting hints of guest free pages to host via virtio-balloon. Host requests the guest to report free pages by sending a new cmd id to the guest via the

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-17 Thread Pankaj Gupta
> > Negotiation of the VIRTIO_BALLOON_F_FREE_PAGE_VQ feature indicates the > support of reporting hints of guest free pages to host via virtio-balloon. > > Host requests the guest to report free pages by sending a new cmd > id to the guest via the free_page_report_cmd_id configuration register.

Re: [PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-17 Thread Pankaj Gupta
> > Negotiation of the VIRTIO_BALLOON_F_FREE_PAGE_VQ feature indicates the > support of reporting hints of guest free pages to host via virtio-balloon. > > Host requests the guest to report free pages by sending a new cmd > id to the guest via the free_page_report_cmd_id configuration register.

[PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-16 Thread Wei Wang
Negotiation of the VIRTIO_BALLOON_F_FREE_PAGE_VQ feature indicates the support of reporting hints of guest free pages to host via virtio-balloon. Host requests the guest to report free pages by sending a new cmd id to the guest via the free_page_report_cmd_id configuration register. When the

[PATCH v22 2/3] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ

2018-01-16 Thread Wei Wang
Negotiation of the VIRTIO_BALLOON_F_FREE_PAGE_VQ feature indicates the support of reporting hints of guest free pages to host via virtio-balloon. Host requests the guest to report free pages by sending a new cmd id to the guest via the free_page_report_cmd_id configuration register. When the