From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964962AbeAXRdO (ORCPT ); Wed, 24 Jan 2018 12:33:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38968 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964844AbeAXRdN (ORCPT ); Wed, 24 Jan 2018 12:33:13 -0500 Date: Wed, 24 Jan 2018 19:32:59 +0200 From: "Michael S. Tsirkin" To: Wei Wang Cc: virtio-dev@lists.oasis-open.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, linux-mm@kvack.org, mhocko@kernel.org, akpm@linux-foundation.org, pbonzini@redhat.com, liliang.opensource@gmail.com, yang.zhang.wz@gmail.com, quan.xu0@gmail.com, nilal@redhat.com, riel@redhat.com Subject: Re: [PATCH v23 2/2] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_VQ Message-ID: <20180124193217-mutt-send-email-mst@kernel.org> References: <1516762227-36346-1-git-send-email-wei.w.wang@intel.com> <1516762227-36346-3-git-send-email-wei.w.wang@intel.com> <20180124064923-mutt-send-email-mst@kernel.org> <5A681E03.1030007@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5A681E03.1030007@intel.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 24, 2018 at 01:47:47PM +0800, Wei Wang wrote: > On 01/24/2018 01:01 PM, Michael S. Tsirkin wrote: > > On Wed, Jan 24, 2018 at 10:50:27AM +0800, Wei Wang wrote: > > This will not DTRT in all cases. It's quite possible > > that host does not need the kick when ring is half full but > > does need it later when ring is full. > > You can kick at ring half full as optimization but you absolutely > > still must kick on ring full. Something like: > > > > if (vq->num_free == virtqueue_get_vring_size(vq) / 2 || > > vq->num_free <= 2) > > Right. Would "if (vq->num_free < virtqueue_get_vring_size(vq) / 2" be > better? > > > Best, > Wei It gives more kicks ... this reminds me, you need to validate that vring size is at least 2, otherwise fail probe. -- MST