Received: by 10.223.176.46 with SMTP id f43csp1561464wra; Wed, 24 Jan 2018 19:30:18 -0800 (PST) X-Google-Smtp-Source: AH8x227YuOHzQkCV31HnCypCXyesTxpztIAIa+fMUewuF69iCVdEHGI5nzf2SFn1lFm41IUHEAfO X-Received: by 2002:a17:902:c81:: with SMTP id 1-v6mr10047093plt.281.1516851018541; Wed, 24 Jan 2018 19:30:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516851018; cv=none; d=google.com; s=arc-20160816; b=vYOJhas62UwM71XM0/K4fmcBkRZuIc0Ch0U3s3PTuE6IyX5Hu2mGX2INhSSTXh5frM h6Pfya7I7iW9RDipoZx5s6RGNjXui0NuwQS2sKt23IB3W1MLk4j9qW/0LcTmHpmZ0SUu sSmypqEAOigA1lYL9af6smTZTiVyfo5YQ/On7zcY1n60A057/lfQBx0GMbCLXTl1VUKk HhmqQp8hL92O5OLXeF4Mg+j39rkX4gVpifMo5hB8O7+N4uE1ik3N5yqwM1n59iBblyyv ystocw/YxVCX2T6F/SUtYaRUcAUDRtvtDZ35mA7GmigvcgjJuWKOpx6B7aitA1d2+IWB kW4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :references:subject:cc:to:mime-version:user-agent:from:date :message-id:arc-authentication-results; bh=O0kmJbVk1g7YJtIQsXsOijEG0BNVps9mTUErk8Ms3B4=; b=a8gi0KD0E+qU0OA2FY6zryOEOOCQ5HERMgNiBNgQXYp/JS3lK0vfB/RIoy4Xp0pCbq 1Ihj3myXTpuPErNBYJ2lOuVlVu17NMRRlzEzRWRUwi39aQHu+/MWKbCOp/V9PqwmXSrB 4PklF3pcia5cLxHviAqtp/M5z1gAbKHL/U5p94jJgmIzMsTlQBdFsFhu1ZUUDQBDdhJq 88bFXk295ursfAZLlKDYATjjToyk+8tdLcQ1na2gv7VD/AA2JkT6w+Yd/nzEE+zc6lXE s4+iIYlha2z/3SIgm9bwLHQszHJLAeuLqU4zQuW0yAyVROVwk2R++leWuyQcUrHRF62h LlAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a14si984872pgd.49.2018.01.24.19.30.04; Wed, 24 Jan 2018 19:30:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933331AbeAYD3i (ORCPT + 99 others); Wed, 24 Jan 2018 22:29:38 -0500 Received: from mga07.intel.com ([134.134.136.100]:50988 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933236AbeAYD3g (ORCPT ); Wed, 24 Jan 2018 22:29:36 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Jan 2018 19:29:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,409,1511856000"; d="scan'208";a="12987900" Received: from unknown (HELO [10.239.13.97]) ([10.239.13.97]) by fmsmga008.fm.intel.com with ESMTP; 24 Jan 2018 19:29:32 -0800 Message-ID: <5A694FB5.5090803@intel.com> Date: Thu, 25 Jan 2018 11:32:05 +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: 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 v24 2/2] virtio-balloon: VIRTIO_BALLOON_F_FREE_PAGE_HINT References: <1516790562-37889-1-git-send-email-wei.w.wang@intel.com> <1516790562-37889-3-git-send-email-wei.w.wang@intel.com> <20180124183349-mutt-send-email-mst@kernel.org> In-Reply-To: <20180124183349-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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 01/25/2018 01:15 AM, Michael S. Tsirkin wrote: > On Wed, Jan 24, 2018 at 06:42:42PM +0800, Wei Wang wrote: > + > +static void report_free_page_func(struct work_struct *work) > +{ > + struct virtio_balloon *vb; > + unsigned long flags; > + > + vb = container_of(work, struct virtio_balloon, report_free_page_work); > + > + /* Start by sending the obtained cmd id to the host with an outbuf */ > + send_cmd_id(vb, &vb->start_cmd_id); > + > + /* > + * Set start_cmd_id to VIRTIO_BALLOON_FREE_PAGE_REPORT_STOP_ID to > + * indicate a new request can be queued. > + */ > + spin_lock_irqsave(&vb->stop_update_lock, flags); > + vb->start_cmd_id = cpu_to_virtio32(vb->vdev, > + VIRTIO_BALLOON_FREE_PAGE_REPORT_STOP_ID); > + spin_unlock_irqrestore(&vb->stop_update_lock, flags); > + > + walk_free_mem_block(vb, 0, &virtio_balloon_send_free_pages); > Can you teach walk_free_mem_block to return the && of all > return calls, so caller knows whether it completed? There will be two cases that can cause walk_free_mem_block to return without completing: 1) host requests to stop in advance 2) vq->broken How about letting walk_free_mem_block simply return the value returned by its callback (i.e. virtio_balloon_send_free_pages)? For host requests to stop, it returns "1", and the above only bails out when walk_free_mem_block return a "< 0" value. Best, Wei