Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp6911857ybe; Wed, 18 Sep 2019 11:04:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqyvFYh7K81moyb1TrOadx7M+dN2/3hDs88TRlN39bf6alphMIZ7SDBJo+a6zRzahdjtJHxS X-Received: by 2002:a50:935d:: with SMTP id n29mr11730973eda.294.1568829887237; Wed, 18 Sep 2019 11:04:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568829886; cv=none; d=google.com; s=arc-20160816; b=aIRI57r/j8UvoPTLEHDxRDPS57E8PhmztbxJ6LDuaT2f5mLabDoKfNNZV/egrfCzet +K1xGLynDy9fZEz3TWN//MZuWJuN4q/6Gl2IrW6ptltBxBDB2qkpuxTNjVpJjzXbQwQO gI6WhG+KzzED0oERBtQZk1WbtfnYvjJVIjQhhx6tByZB3yQJz7SqdaU/+1hzqDJRBp8Z Om7jKnBnWQV+Sr4u2tovzWIi6Whu/JpRqOfazp69V4h4XHiUHf+EfTx0HZWJfuTcE/rV jXObm4P1X0VfCguywVpZwZ3huwdYKPvgRspVjPWgv8W5PcUZvMDMIJt1+PtHEj6Vg9So 5dvg== 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; bh=95uHNXLpbAw8Te8P7uq0ffZGCmMKa4Edsq7nRG4mv4c=; b=kbCaX4E26zUJbPnb7Usvz4dB2HAAVx79QhEfwjORo3SFVyjQqYCpRvniH8SE5EV8UH oKGrjtz3fdt+SZfsLYnxsqqdwVFSfHZTmpF54gIlusxEc9pw+U9cPAo+7+99uxxzLxbk ju21dULOsfQxi2qyxxtijpWbcPQwQBUWLr62Kz/tNJNq7KpfboBZMmlWUiVheGLtAGBJ tQve7SK73ky4Ruz7p6iMV/BpWkGYAec4GnwxUXGtuA2S0amzkuG9J0yKSHFMbNDigVEs l8z8ilRXAwgGUa0tC9JeqnNVRcZJ/Z1tPClgGImXokaWaGekAHQd97HdgjK9fJWO5sOk m0DQ== 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 e7si3571878edn.267.2019.09.18.11.03.51; Wed, 18 Sep 2019 11:04:46 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729366AbfIRR7H (ORCPT + 99 others); Wed, 18 Sep 2019 13:59:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37142 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727057AbfIRR7G (ORCPT ); Wed, 18 Sep 2019 13:59:06 -0400 Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 08DA2369DA for ; Wed, 18 Sep 2019 17:59:06 +0000 (UTC) Received: by mail-qt1-f198.google.com with SMTP id z21so894255qtq.21 for ; Wed, 18 Sep 2019 10:59:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=95uHNXLpbAw8Te8P7uq0ffZGCmMKa4Edsq7nRG4mv4c=; b=CPMxjDBf4OgYQBsknXbnVvGybpRQlJ5GUZzLs9zz7mZmensDYoxKUf4pqM788crC6D /SLn/6nrOyTgU/WftH6P7MvsJ4OOdA3ndCpdVpD4bqiXLK4JJsQd/Kxyqkn8SRYSQ1GQ oPxLg73WQhaE8UQNhOZRglBO/tMYh2gbli1VhtCn9ZyMYv3dLJFyCyFV5lDi/x9hqYG+ tSfHPc/nbX6YQ2K6fDt9w2XRVtvYVscGGunr8oRNzF/tOwNCFvHvaCVlvRbzmbkUgEio Bw69o4Htzk+2Y44jTjoFe4RtRjTVpWkM/FSh0HqmMXERX0zlQqMZOX/G8iraDQLkeXvP Dzlw== X-Gm-Message-State: APjAAAWcML+FaKMjkl0pyKVTktMwdB9nM/1pkqUagCPz1oaJcLISwnn5 PNPbE6HqksZXMSQymCUI5gH8+qEVHQByORYCYqgaR7FwpknNQzKGrh1/lqJXH34CK6b9OqGl7j1 GvHr6KICOJ5qUQHUCJEr+6A22 X-Received: by 2002:ac8:7b2a:: with SMTP id l10mr5571332qtu.115.1568829545295; Wed, 18 Sep 2019 10:59:05 -0700 (PDT) X-Received: by 2002:ac8:7b2a:: with SMTP id l10mr5571319qtu.115.1568829545135; Wed, 18 Sep 2019 10:59:05 -0700 (PDT) Received: from redhat.com (bzq-79-176-40-226.red.bezeqint.net. [79.176.40.226]) by smtp.gmail.com with ESMTPSA id q126sm3855323qkf.47.2019.09.18.10.58.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Sep 2019 10:59:04 -0700 (PDT) Date: Wed, 18 Sep 2019 13:58:55 -0400 From: "Michael S. Tsirkin" To: Alexander Duyck Cc: virtio-dev@lists.oasis-open.org, kvm@vger.kernel.org, david@redhat.com, dave.hansen@intel.com, linux-kernel@vger.kernel.org, willy@infradead.org, mhocko@kernel.org, linux-mm@kvack.org, vbabka@suse.cz, akpm@linux-foundation.org, mgorman@techsingularity.net, linux-arm-kernel@lists.infradead.org, osalvador@suse.de, 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, pbonzini@redhat.com, dan.j.williams@intel.com, alexander.h.duyck@linux.intel.com Subject: Re: [PATCH v10 5/6] virtio-balloon: Pull page poisoning config out of free page hinting Message-ID: <20190918135833-mutt-send-email-mst@kernel.org> References: <20190918175109.23474.67039.stgit@localhost.localdomain> <20190918175305.23474.34783.stgit@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190918175305.23474.34783.stgit@localhost.localdomain> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 18, 2019 at 10:53:05AM -0700, 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. > > Reviewed-by: David Hildenbrand > Signed-off-by: Alexander Duyck I think this one can go in directly. Do you want me to merge it now? > --- > 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..501a8d0ebf86 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 the hypervisor know that we are expecting a > + * specific value to be written back in unused pages. > + */ > + 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()) > + /* 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);