From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: virtio-dev-return-2383-cohuck=redhat.com@lists.oasis-open.org Sender: List-Post: List-Help: List-Unsubscribe: List-Subscribe: Received: from lists.oasis-open.org (oasis-open.org [66.179.20.138]) by lists.oasis-open.org (Postfix) with ESMTP id 688B85818C68 for ; Wed, 12 Jul 2017 06:26:32 -0700 (PDT) Message-ID: <5966241C.9060503@intel.com> Date: Wed, 12 Jul 2017 21:29:00 +0800 From: Wei Wang MIME-Version: 1.0 References: <1499863221-16206-1-git-send-email-wei.w.wang@intel.com> <1499863221-16206-6-git-send-email-wei.w.wang@intel.com> <20170712160129-mutt-send-email-mst@kernel.org> In-Reply-To: <20170712160129-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: [virtio-dev] Re: [PATCH v12 5/8] virtio-balloon: VIRTIO_BALLOON_F_SG To: "Michael S. Tsirkin" Cc: linux-kernel@vger.kernel.org, qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, linux-mm@kvack.org, david@redhat.com, cornelia.huck@de.ibm.com, akpm@linux-foundation.org, mgorman@techsingularity.net, aarcange@redhat.com, amit.shah@redhat.com, pbonzini@redhat.com, liliang.opensource@gmail.com, virtio-dev@lists.oasis-open.org, yang.zhang.wz@gmail.com, quan.xu@aliyun.com List-ID: On 07/12/2017 09:06 PM, Michael S. Tsirkin wrote: > On Wed, Jul 12, 2017 at 08:40:18PM +0800, Wei Wang wrote: >> diff --git a/include/linux/virtio.h b/include/linux/virtio.h >> index 28b0e96..9f27101 100644 >> --- a/include/linux/virtio.h >> +++ b/include/linux/virtio.h >> @@ -57,8 +57,28 @@ int virtqueue_add_sgs(struct virtqueue *vq, >> void *data, >> gfp_t gfp); >> >> +/* A desc with this init id is treated as an invalid desc */ >> +#define VIRTQUEUE_DESC_ID_INIT UINT_MAX >> +int virtqueue_add_chain_desc(struct virtqueue *_vq, >> + uint64_t addr, >> + uint32_t len, >> + unsigned int *head_id, >> + unsigned int *prev_id, >> + bool in); >> + >> +int virtqueue_add_chain(struct virtqueue *_vq, >> + unsigned int head, >> + bool indirect, >> + struct vring_desc *indirect_desc, >> + void *data, >> + void *ctx); >> + >> bool virtqueue_kick(struct virtqueue *vq); >> >> +bool virtqueue_kick_sync(struct virtqueue *vq); >> + >> +bool virtqueue_kick_async(struct virtqueue *vq, wait_queue_head_t wq); >> + >> bool virtqueue_kick_prepare(struct virtqueue *vq); >> >> bool virtqueue_notify(struct virtqueue *vq); > I don't much care for this API. It does exactly what balloon needs, > but at cost of e.g. transparently busy-waiting. Unlikely to be > a good fit for anything else. If you were referring to this API - virtqueue_add_chain_desc(): Busy waiting only happens when the vq is full (i.e. no desc left). If necessary, I think we can add an input parameter like "bool busywaiting", then the caller can decide to simply get a -ENOSPC or busy wait to add when no desc is available. > > If you don't like my original _first/_next/_last, you will > need to come up with something else. I thought the above virtqueue_add_chain_des() performs the same functionality as _first/next/last, which are used to grab descs from the vq and chain them together. If not, could you please elaborate the usage of the original proposal? Best, Wei --------------------------------------------------------------------- To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Wang Subject: Re: [PATCH v12 5/8] virtio-balloon: VIRTIO_BALLOON_F_SG Date: Wed, 12 Jul 2017 21:29:00 +0800 Message-ID: <5966241C.9060503@intel.com> References: <1499863221-16206-1-git-send-email-wei.w.wang@intel.com> <1499863221-16206-6-git-send-email-wei.w.wang@intel.com> <20170712160129-mutt-send-email-mst@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: linux-kernel@vger.kernel.org, qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, linux-mm@kvack.org, david@redhat.com, cornelia.huck@de.ibm.com, akpm@linux-foundation.org, mgorman@techsingularity.net, aarcange@redhat.com, amit.shah@redhat.com, pbonzini@redhat.com, liliang.opensource@gmail.com, virtio-dev@lists.oasis-open.org, yang.zhang.wz@gmail.com, quan.xu@aliyun.com To: "Michael S. Tsirkin" Return-path: In-Reply-To: <20170712160129-mutt-send-email-mst@kernel.org> Sender: owner-linux-mm@kvack.org List-Id: kvm.vger.kernel.org On 07/12/2017 09:06 PM, Michael S. Tsirkin wrote: > On Wed, Jul 12, 2017 at 08:40:18PM +0800, Wei Wang wrote: >> diff --git a/include/linux/virtio.h b/include/linux/virtio.h >> index 28b0e96..9f27101 100644 >> --- a/include/linux/virtio.h >> +++ b/include/linux/virtio.h >> @@ -57,8 +57,28 @@ int virtqueue_add_sgs(struct virtqueue *vq, >> void *data, >> gfp_t gfp); >> >> +/* A desc with this init id is treated as an invalid desc */ >> +#define VIRTQUEUE_DESC_ID_INIT UINT_MAX >> +int virtqueue_add_chain_desc(struct virtqueue *_vq, >> + uint64_t addr, >> + uint32_t len, >> + unsigned int *head_id, >> + unsigned int *prev_id, >> + bool in); >> + >> +int virtqueue_add_chain(struct virtqueue *_vq, >> + unsigned int head, >> + bool indirect, >> + struct vring_desc *indirect_desc, >> + void *data, >> + void *ctx); >> + >> bool virtqueue_kick(struct virtqueue *vq); >> >> +bool virtqueue_kick_sync(struct virtqueue *vq); >> + >> +bool virtqueue_kick_async(struct virtqueue *vq, wait_queue_head_t wq); >> + >> bool virtqueue_kick_prepare(struct virtqueue *vq); >> >> bool virtqueue_notify(struct virtqueue *vq); > I don't much care for this API. It does exactly what balloon needs, > but at cost of e.g. transparently busy-waiting. Unlikely to be > a good fit for anything else. If you were referring to this API - virtqueue_add_chain_desc(): Busy waiting only happens when the vq is full (i.e. no desc left). If necessary, I think we can add an input parameter like "bool busywaiting", then the caller can decide to simply get a -ENOSPC or busy wait to add when no desc is available. > > If you don't like my original _first/_next/_last, you will > need to come up with something else. I thought the above virtqueue_add_chain_des() performs the same functionality as _first/next/last, which are used to grab descs from the vq and chain them together. If not, could you please elaborate the usage of the original proposal? Best, Wei -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752595AbdGLN0c (ORCPT ); Wed, 12 Jul 2017 09:26:32 -0400 Received: from mga02.intel.com ([134.134.136.20]:55766 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751060AbdGLN0b (ORCPT ); Wed, 12 Jul 2017 09:26:31 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,349,1496127600"; d="scan'208";a="125671262" Message-ID: <5966241C.9060503@intel.com> Date: Wed, 12 Jul 2017 21:29:00 +0800 From: Wei Wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: "Michael S. Tsirkin" CC: linux-kernel@vger.kernel.org, qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, linux-mm@kvack.org, david@redhat.com, cornelia.huck@de.ibm.com, akpm@linux-foundation.org, mgorman@techsingularity.net, aarcange@redhat.com, amit.shah@redhat.com, pbonzini@redhat.com, liliang.opensource@gmail.com, virtio-dev@lists.oasis-open.org, yang.zhang.wz@gmail.com, quan.xu@aliyun.com Subject: Re: [PATCH v12 5/8] virtio-balloon: VIRTIO_BALLOON_F_SG References: <1499863221-16206-1-git-send-email-wei.w.wang@intel.com> <1499863221-16206-6-git-send-email-wei.w.wang@intel.com> <20170712160129-mutt-send-email-mst@kernel.org> In-Reply-To: <20170712160129-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/12/2017 09:06 PM, Michael S. Tsirkin wrote: > On Wed, Jul 12, 2017 at 08:40:18PM +0800, Wei Wang wrote: >> diff --git a/include/linux/virtio.h b/include/linux/virtio.h >> index 28b0e96..9f27101 100644 >> --- a/include/linux/virtio.h >> +++ b/include/linux/virtio.h >> @@ -57,8 +57,28 @@ int virtqueue_add_sgs(struct virtqueue *vq, >> void *data, >> gfp_t gfp); >> >> +/* A desc with this init id is treated as an invalid desc */ >> +#define VIRTQUEUE_DESC_ID_INIT UINT_MAX >> +int virtqueue_add_chain_desc(struct virtqueue *_vq, >> + uint64_t addr, >> + uint32_t len, >> + unsigned int *head_id, >> + unsigned int *prev_id, >> + bool in); >> + >> +int virtqueue_add_chain(struct virtqueue *_vq, >> + unsigned int head, >> + bool indirect, >> + struct vring_desc *indirect_desc, >> + void *data, >> + void *ctx); >> + >> bool virtqueue_kick(struct virtqueue *vq); >> >> +bool virtqueue_kick_sync(struct virtqueue *vq); >> + >> +bool virtqueue_kick_async(struct virtqueue *vq, wait_queue_head_t wq); >> + >> bool virtqueue_kick_prepare(struct virtqueue *vq); >> >> bool virtqueue_notify(struct virtqueue *vq); > I don't much care for this API. It does exactly what balloon needs, > but at cost of e.g. transparently busy-waiting. Unlikely to be > a good fit for anything else. If you were referring to this API - virtqueue_add_chain_desc(): Busy waiting only happens when the vq is full (i.e. no desc left). If necessary, I think we can add an input parameter like "bool busywaiting", then the caller can decide to simply get a -ENOSPC or busy wait to add when no desc is available. > > If you don't like my original _first/_next/_last, you will > need to come up with something else. I thought the above virtqueue_add_chain_des() performs the same functionality as _first/next/last, which are used to grab descs from the vq and chain them together. If not, could you please elaborate the usage of the original proposal? Best, Wei From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54919) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVHf1-0006eR-3h for qemu-devel@nongnu.org; Wed, 12 Jul 2017 09:26:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVHex-0005y0-Sl for qemu-devel@nongnu.org; Wed, 12 Jul 2017 09:26:35 -0400 Received: from mga14.intel.com ([192.55.52.115]:55187) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVHex-0005wd-EE for qemu-devel@nongnu.org; Wed, 12 Jul 2017 09:26:31 -0400 Message-ID: <5966241C.9060503@intel.com> Date: Wed, 12 Jul 2017 21:29:00 +0800 From: Wei Wang MIME-Version: 1.0 References: <1499863221-16206-1-git-send-email-wei.w.wang@intel.com> <1499863221-16206-6-git-send-email-wei.w.wang@intel.com> <20170712160129-mutt-send-email-mst@kernel.org> In-Reply-To: <20170712160129-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v12 5/8] virtio-balloon: VIRTIO_BALLOON_F_SG List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: linux-kernel@vger.kernel.org, qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, linux-mm@kvack.org, david@redhat.com, cornelia.huck@de.ibm.com, akpm@linux-foundation.org, mgorman@techsingularity.net, aarcange@redhat.com, amit.shah@redhat.com, pbonzini@redhat.com, liliang.opensource@gmail.com, virtio-dev@lists.oasis-open.org, yang.zhang.wz@gmail.com, quan.xu@aliyun.com On 07/12/2017 09:06 PM, Michael S. Tsirkin wrote: > On Wed, Jul 12, 2017 at 08:40:18PM +0800, Wei Wang wrote: >> diff --git a/include/linux/virtio.h b/include/linux/virtio.h >> index 28b0e96..9f27101 100644 >> --- a/include/linux/virtio.h >> +++ b/include/linux/virtio.h >> @@ -57,8 +57,28 @@ int virtqueue_add_sgs(struct virtqueue *vq, >> void *data, >> gfp_t gfp); >> >> +/* A desc with this init id is treated as an invalid desc */ >> +#define VIRTQUEUE_DESC_ID_INIT UINT_MAX >> +int virtqueue_add_chain_desc(struct virtqueue *_vq, >> + uint64_t addr, >> + uint32_t len, >> + unsigned int *head_id, >> + unsigned int *prev_id, >> + bool in); >> + >> +int virtqueue_add_chain(struct virtqueue *_vq, >> + unsigned int head, >> + bool indirect, >> + struct vring_desc *indirect_desc, >> + void *data, >> + void *ctx); >> + >> bool virtqueue_kick(struct virtqueue *vq); >> >> +bool virtqueue_kick_sync(struct virtqueue *vq); >> + >> +bool virtqueue_kick_async(struct virtqueue *vq, wait_queue_head_t wq); >> + >> bool virtqueue_kick_prepare(struct virtqueue *vq); >> >> bool virtqueue_notify(struct virtqueue *vq); > I don't much care for this API. It does exactly what balloon needs, > but at cost of e.g. transparently busy-waiting. Unlikely to be > a good fit for anything else. If you were referring to this API - virtqueue_add_chain_desc(): Busy waiting only happens when the vq is full (i.e. no desc left). If necessary, I think we can add an input parameter like "bool busywaiting", then the caller can decide to simply get a -ENOSPC or busy wait to add when no desc is available. > > If you don't like my original _first/_next/_last, you will > need to come up with something else. I thought the above virtqueue_add_chain_des() performs the same functionality as _first/next/last, which are used to grab descs from the vq and chain them together. If not, could you please elaborate the usage of the original proposal? Best, Wei