Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5971645ybe; Tue, 10 Sep 2019 11:32:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqya04MMXGGOpfHD30Z510LHit+w7G1ESrGgaxTDCrTg0s0yJDdUPMTJd4Vnds4NJY8Ggs23 X-Received: by 2002:aa7:cf83:: with SMTP id z3mr28186112edx.68.1568140341392; Tue, 10 Sep 2019 11:32:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568140341; cv=none; d=google.com; s=arc-20160816; b=f1mvz99U9Cm6NsCFcUl3Izxf2a07/Fzv6BGSb5kPOJN9oyCBnZhNJJXUFVyxmnY/m6 yRPYYQyAgV9QoGmA18Lg+jK5iwIu1UW8JnzjwCWpFyaH61k5Mk1e7+Gc/rQraANW1vAS 3E2GrFjdcHhAE+uiGbM1iw21tPSPQiaLa4D+AUlc5QV7lg8pezOx8/yAeGne5Z3r7Oq+ mnzhrVZQqoDC56f+lfkdtVwZwIHHSXXNABNDDOaGjtEvGQoKGkxzzsEmXX3fp0B/RnRJ gDsrmO0gZdg41MEFgcAwPIbF3JGvDU4RqAwZRlPHcSnbyivcZjUucOptiS+eHn8W+TqZ 3wOg== 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:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=TYGvenUBhb7BVKBnYoDwhezmQUhpEsgZgh7mjd4PGmk=; b=sROX+AZLa9BA/sJsNmOTqhQLOdpXPiJwEjiMH8mQXvhkHcCk91KZKCqtytu92/jNJg J0xd9DptiG6y7nyIhpXbhXlld7gd3E5JZN5+MzHx7/LaeEuRGqS4SB/nCKVkaZr+fbJ+ qHbsOta0PAd3LlDR6viAfiY4Ul044YDN1D7LE0WHAH/zjswOW/tw+dj5hMRDlKSIK5Lb 5kiw38JRVpV7aeTwxbCyyYLCTiZ5jO9qeZXFjzBPEfyk9AKAJFCRvFaJXnT9/3QBXOOK MRyaA/wsab5i+CR6+KtRdU05grFjqjqf1IB0Ue2uw3jLHPoWQRGZD20moqAr8JIMCDVL hjCw== 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id on24si10261150ejb.259.2019.09.10.11.31.57; Tue, 10 Sep 2019 11:32:21 -0700 (PDT) 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388275AbfIIPbw (ORCPT + 99 others); Mon, 9 Sep 2019 11:31:52 -0400 Received: from mga06.intel.com ([134.134.136.31]:40300 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727674AbfIIPbw (ORCPT ); Mon, 9 Sep 2019 11:31:52 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Sep 2019 08:31:51 -0700 X-IronPort-AV: E=Sophos;i="5.64,486,1559545200"; d="scan'208";a="359515642" Received: from ahduyck-desk1.jf.intel.com ([10.7.198.76]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Sep 2019 08:31:51 -0700 Message-ID: Subject: Re: [PATCH v9 7/8] virtio-balloon: Pull page poisoning config out of free page hinting From: Alexander Duyck To: David Hildenbrand , Alexander Duyck , virtio-dev@lists.oasis-open.org, kvm@vger.kernel.org, mst@redhat.com, catalin.marinas@arm.com, dave.hansen@intel.com, linux-kernel@vger.kernel.org, willy@infradead.org, mhocko@kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, will@kernel.org, linux-arm-kernel@lists.infradead.org, osalvador@suse.de Cc: yang.zhang.wz@gmail.com, pagupta@redhat.com, konrad.wilk@oracle.com, nitesh@redhat.com, riel@surriel.com, lcapitulino@redhat.com, wei.w.wang@intel.com, aarcange@redhat.com, ying.huang@intel.com, pbonzini@redhat.com, dan.j.williams@intel.com, fengguang.wu@intel.com, kirill.shutemov@linux.intel.com Date: Mon, 09 Sep 2019 08:31:51 -0700 In-Reply-To: <4dfcf372-97be-65ab-1349-75f24aa4f98a@redhat.com> References: <20190907172225.10910.34302.stgit@localhost.localdomain> <20190907172601.10910.95355.stgit@localhost.localdomain> <4dfcf372-97be-65ab-1349-75f24aa4f98a@redhat.com> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.30.5 (3.30.5-1.fc29) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2019-09-09 at 10:59 +0200, David Hildenbrand wrote: > On 07.09.19 19:26, Alexander Duyck wrote: > > From: Alexander Duyck > > > > Currently the page poisoning setting wasn't being enabled unless free page > > hinting was enabled. However we will need the page poisoning tracking logic > > as well for unused page reporting. As such pull it out and make it a > > separate bit of config in the probe function. > > > > In addition we can actually wrap the code in a check for NO_SANITY. If we > > don't care what is actually in the page we can just default to 0 and leave > > it there. > > > > Signed-off-by: Alexander Duyck > > --- > > drivers/virtio/virtio_balloon.c | 22 +++++++++++++++------- > > 1 file changed, 15 insertions(+), 7 deletions(-) > > > > diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_balloon.c > > index 226fbb995fb0..d2547df7de93 100644 > > --- a/drivers/virtio/virtio_balloon.c > > +++ b/drivers/virtio/virtio_balloon.c > > @@ -842,7 +842,6 @@ static int virtio_balloon_register_shrinker(struct virtio_balloon *vb) > > static int virtballoon_probe(struct virtio_device *vdev) > > { > > struct virtio_balloon *vb; > > - __u32 poison_val; > > int err; > > > > if (!vdev->config->get) { > > @@ -909,11 +908,18 @@ static int virtballoon_probe(struct virtio_device *vdev) > > VIRTIO_BALLOON_CMD_ID_STOP); > > spin_lock_init(&vb->free_page_list_lock); > > INIT_LIST_HEAD(&vb->free_page_list); > > - if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_PAGE_POISON)) { > > - memset(&poison_val, PAGE_POISON, sizeof(poison_val)); > > - virtio_cwrite(vb->vdev, struct virtio_balloon_config, > > - poison_val, &poison_val); > > - } > > + } > > + if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_PAGE_POISON)) { > > + __u32 poison_val; > > + > > + /* > > + * Let hypervisor know that we are expecting a specific > > + * value to be written back in unused pages. > > + */ > > "Let the hypervisor know" ... ? > > > + memset(&poison_val, PAGE_POISON, sizeof(poison_val)); > > + > > + virtio_cwrite(vb->vdev, struct virtio_balloon_config, > > + poison_val, &poison_val); > > } > > /* > > * We continue to use VIRTIO_BALLOON_F_DEFLATE_ON_OOM to decide if a > > @@ -1014,7 +1020,9 @@ static int virtballoon_restore(struct virtio_device *vdev) > > > > static int virtballoon_validate(struct virtio_device *vdev) > > { > > - if (!page_poisoning_enabled()) > > + /* Notify host if we care about poison value */ > > "Tell the host whether we care about poisoned pages." ? > > > + if (IS_ENABLED(CONFIG_PAGE_POISONING_NO_SANITY) || > > + !page_poisoning_enabled()) > > __virtio_clear_bit(vdev, VIRTIO_BALLOON_F_PAGE_POISON); > > > > __virtio_clear_bit(vdev, VIRTIO_F_IOMMU_PLATFORM); > > > > Reviewed-by: David Hildenbrand > Thanks. I will update the comments for v10. - Alex