Received: by 10.223.176.46 with SMTP id f43csp108333wra; Thu, 18 Jan 2018 14:39:07 -0800 (PST) X-Google-Smtp-Source: ACJfBouEe1VIQzbHWqcbz4iPoMx3rho2htlLDHx9RjvAeb+saKWAlEvF2AmD/wEJVgmSuIX2Bjd7 X-Received: by 10.99.186.87 with SMTP id l23mr28406994pgu.83.1516315147299; Thu, 18 Jan 2018 14:39:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516315147; cv=none; d=google.com; s=arc-20160816; b=xR0Fsc2DSThNoURaimuGM4qeYqoiFOT/A2T7kQJymSuThZ/umdI0saTSXl7laF2hqw rb9MjzPLTRMn5acX+JOrkloEJEQpX1vY+rn/xo5h53auX14RkxoePakCkRqtsEESEUZa m12Ar63jBfhWh34YWUfEKtSxAt6RI0YmIUcv2FPCyz9ymHKI99p5+gUlV22W+FhgNc1r bMUk/bcxToezECA/IofsZRBzONdcnChk7yB3hYQxJFwFuWRED7ZUCBN+keYNQpBrfDoC 6yKBHBtZdnObZ6DWORDgBynGu893gZJ0ooeCa8TqNDFoz3hK3vTvnv2Z9ozZwdgnB2Nx rbIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=Q8Bqdd6LEajvMev9vTBEANWNYcdiX5wwven9jTdYYNo=; b=EJY9gEERxMPodxOPQ1vf+X0094x1er3RB/jttzgIXP40WJ48ASu5rbPcUJiK6g1SOz UqGasMrWOcP2U3rOjCEwt3+wsb3cDaXLJeU3LM/ZRqeBbxcN6xqOrXdAJdXOR8JBD6L6 fH2yTnqWG9LPzkPMUI4r5C/bFtiz4aWkfRbLodjR5sS1Fm5Vvk0LAUovfIkYfNUfkZjX s+Ab70fBEL6j0r0boGJyC62zOYOGRF5HquczoOY8coTgquEAo7vhZmtmoK+6GMI2kp7M 0lIVNkRQwe/lpbLeb6YBow48K+mp9GLQZKL//0YsiZ9mWwHEEz6z/ZJ5x8t47rJ0Z5UQ RaEg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i2si8087166pfd.57.2018.01.18.14.38.53; Thu, 18 Jan 2018 14:39:07 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932567AbeARWhf (ORCPT + 99 others); Thu, 18 Jan 2018 17:37:35 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48250 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932131AbeARWh2 (ORCPT ); Thu, 18 Jan 2018 17:37:28 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D49D15D687; Thu, 18 Jan 2018 22:37:27 +0000 (UTC) Received: from redhat.com (ovpn-127-36.rdu2.redhat.com [10.10.127.36]) by smtp.corp.redhat.com (Postfix) with SMTP id 6E20378E7D; Thu, 18 Jan 2018 22:37:19 +0000 (UTC) Date: Fri, 19 Jan 2018 00:37:18 +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 v22 3/3] virtio-balloon: don't report free pages when page poisoning is enabled Message-ID: <20180119003650-mutt-send-email-mst@kernel.org> References: <1516165812-3995-1-git-send-email-wei.w.wang@intel.com> <1516165812-3995-4-git-send-email-wei.w.wang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1516165812-3995-4-git-send-email-wei.w.wang@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 18 Jan 2018 22:37:27 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 17, 2018 at 01:10:12PM +0800, Wei Wang wrote: > The guest free pages should not be discarded by the live migration thread > when page poisoning is enabled with PAGE_POISONING_NO_SANITY=n, because > skipping the transfer of such poisoned free pages will trigger false > positive when new pages are allocated and checked on the destination. > This patch adds a config field, poison_val. Guest writes to the config > field to tell the host about the poisoning value. The value will be 0 in > the following cases: > 1) PAGE_POISONING_NO_SANITY is enabled; > 2) page poisoning is disabled; or > 3) PAGE_POISONING_ZERO is enabled. > > Signed-off-by: Wei Wang > Suggested-by: Michael S. Tsirkin > Cc: Michal Hocko Pls squash with the previous patch. It's not nice to break a config, then fix it up later. > --- > drivers/virtio/virtio_balloon.c | 8 ++++++++ > include/uapi/linux/virtio_balloon.h | 2 ++ > 2 files changed, 10 insertions(+) > > diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c > index b9561a5..5a42235 100644 > --- a/drivers/virtio/virtio_balloon.c > +++ b/drivers/virtio/virtio_balloon.c > @@ -706,6 +706,7 @@ static struct file_system_type balloon_fs = { > static int virtballoon_probe(struct virtio_device *vdev) > { > struct virtio_balloon *vb; > + __u32 poison_val; > int err; > > if (!vdev->config->get) { > @@ -740,6 +741,13 @@ static int virtballoon_probe(struct virtio_device *vdev) > WQ_FREEZABLE | WQ_CPU_INTENSIVE, 0); > INIT_WORK(&vb->report_free_page_work, report_free_page_func); > vb->stop_cmd_id = VIRTIO_BALLOON_FREE_PAGE_REPORT_STOP_ID; > + if (IS_ENABLED(CONFIG_PAGE_POISONING_NO_SANITY) || > + !page_poisoning_enabled()) > + poison_val = 0; > + else > + poison_val = PAGE_POISON; > + virtio_cwrite(vb->vdev, struct virtio_balloon_config, > + poison_val, &poison_val); > } > > vb->nb.notifier_call = virtballoon_oom_notify; > diff --git a/include/uapi/linux/virtio_balloon.h b/include/uapi/linux/virtio_balloon.h > index 55e2456..5861876 100644 > --- a/include/uapi/linux/virtio_balloon.h > +++ b/include/uapi/linux/virtio_balloon.h > @@ -47,6 +47,8 @@ struct virtio_balloon_config { > __u32 actual; > /* Free page report command id, readonly by guest */ > __u32 free_page_report_cmd_id; > + /* Stores PAGE_POISON if page poisoning with sanity check is in use */ > + __u32 poison_val; > }; > > #define VIRTIO_BALLOON_S_SWAP_IN 0 /* Amount of memory swapped in */ > -- > 2.7.4