Received: by 10.223.176.46 with SMTP id f43csp1901413wra; Thu, 25 Jan 2018 01:44:06 -0800 (PST) X-Google-Smtp-Source: AH8x227GtGAeLOln4al8TEaXz7kKhtyWs6meifRjlSPNKzOKOX8ZwX9LTdWXvz24yIRJmxwt7ybE X-Received: by 10.99.67.133 with SMTP id q127mr12928839pga.365.1516873446337; Thu, 25 Jan 2018 01:44:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516873446; cv=none; d=google.com; s=arc-20160816; b=FoavssZAhxC3zO9fGoAhT5KVqH4MIg5Xk+eU1JNI6717tXGYl3tyWIuHIvCycIYObI Eg88uHTvwRZE/k915Lzmk6qASVJSkXlYCAWQaZJCUFY4iLmUTjJSF30i7oPr/B54WRcV IU1BnANzZNgcwFkPHTLqQbyv56DXKWE98NQj5ApFK/MBkvxXrRLboIHp+G3cmqgH7DQB LxOSZVmLyW15p5ybeUwb2UA4lVubWvrHdaqVbUBDqKV1Ui2/rpR1JqvpOtIpOWbSBzem ZtT0G1v20Vir0iSsHSsqmkSOhmwTeC6JxfraywxR2mUH/d4+ijXmqaaEWa2b1lUzOaSq qx/w== 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=dCTpB7m2TySJ8Xim3TUto+ICopOvgIsE79Gz6kihRnY=; b=1FCxLsZz6JkQ7GCOpcz5ODrKND1GPhIhaGTp3c8F1I2SNGyVPkY/S3/ME1u6K9zSEM FfeR0GXpvtIuAtdjrsl3G7KxX81gTS6/19Nh1ihpc08W6+7aJCKtXl+EMvmsTAVfhdSj 2cW9hXpEhmAX9OLKmc/WnWJeC0ddH52aVIEkPSVoEfV9J03dGZoOI46bKeHLEj+lAQOj NMAJqn+GrHrDUTh+7JNM8elzYeFpwIZwsOEq7eHkEIQ6GAvv9FoB1qnv+Sx8ie90Cbmo 45UKDck3OnrirTFgsYCxB1QFx4vD55rvgJxnPvv5U0DN8mTtlFmlFOHs3QVb0QicP0nG zSMA== 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 a91-v6si1675758pla.657.2018.01.25.01.43.52; Thu, 25 Jan 2018 01:44:06 -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 S1751356AbeAYJmz (ORCPT + 99 others); Thu, 25 Jan 2018 04:42:55 -0500 Received: from mga07.intel.com ([134.134.136.100]:3013 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751265AbeAYJmt (ORCPT ); Thu, 25 Jan 2018 04:42:49 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jan 2018 01:42:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,411,1511856000"; d="scan'208";a="24616536" Received: from unknown (HELO [10.239.13.97]) ([10.239.13.97]) by fmsmga004.fm.intel.com with ESMTP; 25 Jan 2018 01:42:46 -0800 Message-ID: <5A69A72F.4000104@intel.com> Date: Thu, 25 Jan 2018 17:45:19 +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: >> >> >> What is this doing? Basically handling the case where vq is broken? >> It's kind of ugly to tweak feature bits, most code assumes they never >> change. Please just return an error to caller instead and handle it >> there. >> >> You can then avoid sprinking the check for the feature bit >> all over the code. >> > > One thing I don't like about this one is that the previous request > will still try to run to completion. > > And it all seems pretty complex. > > How about: > - pass cmd id to a queued work > - queued work gets that cmd id, stores a copy and uses that, > re-checking periodically - stop if cmd id changes: > will replace report_free_page too since that's set to > stop. > > This means you do not reuse the queued cmd id also > for the buffer - which is probably for the best. Thanks for the suggestion. Please have a check how it's implemented in v25. Just a little reminder that work queue has internally ensured that there is no re-entrant of the same queued function. Best, Wei