From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDAB8C2D0BF for ; Fri, 13 Dec 2019 07:03:49 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 787142077B for ; Fri, 13 Dec 2019 07:03:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="TMys/sgS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 787142077B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D2E578E0005; Fri, 13 Dec 2019 02:03:48 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CDEF98E0001; Fri, 13 Dec 2019 02:03:48 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BCD138E0005; Fri, 13 Dec 2019 02:03:48 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0206.hostedemail.com [216.40.44.206]) by kanga.kvack.org (Postfix) with ESMTP id A7F408E0001 for ; Fri, 13 Dec 2019 02:03:48 -0500 (EST) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 7167F2C78 for ; Fri, 13 Dec 2019 07:03:48 +0000 (UTC) X-FDA: 76259228136.10.lip47_5b575ab006c55 X-HE-Tag: lip47_5b575ab006c55 X-Filterd-Recvd-Size: 6930 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by imf02.hostedemail.com (Postfix) with ESMTP for ; Fri, 13 Dec 2019 07:03:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1576220626; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mKb0GwkkMyxyuSPyhxDSAHmn6nr9ap38DqvRSlX3bVI=; b=TMys/sgSLO+Cstyz+pHIEzphSMK/Y/II/OTQzn7dNlijkJLoOpEmuJNliBRzm95TBtnwSM tepLz5YrbBxHDQHLo/zkVIyd0wtMdy6RTBDiCgMhUXqgPWMfDqCx4Yjmwvlha+yiGfYfA9 KwB9/L+PM3C3Ago60CkM/Ecmoykji7o= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-308-iusZm2aBM-Ce35SWRr3Xsg-1; Fri, 13 Dec 2019 02:03:43 -0500 Received: by mail-qv1-f69.google.com with SMTP id v3so1120993qvm.2 for ; Thu, 12 Dec 2019 23:03:43 -0800 (PST) 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=O0TmJQsXXUj8xvxj2oZLq4RGHQS1jnAITIBcro7LElU=; b=VXwzHsKLTEFrwFOg0U4AWlX4znXXABPjnNX9QyROfLNEDDIZrOebLPih7RT1zL8k8r nhPtCrs+r440qyXV5bNn/vYWLd619S+2Qv9z0XOqCul6UeZjRcLanB2LyHk397LVCcGK 0/mOrHM63jyY+/blLTnQ40jhBlOfHCMqFKKrvMd1lAEfa4Reie2EHweLPIocssdqumdh c5+XrLJGb46t/2wKY36X8wVHdDuiJD9BMvA908eXYniub/UtbbloB/cXc47wHqmPBzF0 iOr2H/sMYYrOYGwfnrta+YdZAFFE5F23pGVCmICXw032RhXSfBF670w/2lSIVnZr1obP Ge5w== X-Gm-Message-State: APjAAAVRphDvh5X+pDI3BsfR7Nf8xwh6PwAuR01JYWMmA1I/UTcq8F4B WJ/iWTQHyqnQSKMtpRrWstV3nXCJTIJe//P6vItCkyd7pqgXISUhZlBIX9x3F7dmxmJM0iRi3gH WWp5hUWvhn5s= X-Received: by 2002:a05:620a:25d:: with SMTP id q29mr11763238qkn.158.1576220623040; Thu, 12 Dec 2019 23:03:43 -0800 (PST) X-Google-Smtp-Source: APXvYqwE+l6t4BDHspvGuls9UqQ3pXQQoiWbu2vcki2BukIvZreKNXPLa8JnHLl7gMpZXw6MDOH2qA== X-Received: by 2002:a05:620a:25d:: with SMTP id q29mr11763215qkn.158.1576220622793; Thu, 12 Dec 2019 23:03:42 -0800 (PST) Received: from redhat.com (bzq-79-181-48-215.red.bezeqint.net. [79.181.48.215]) by smtp.gmail.com with ESMTPSA id e13sm2971383qtr.80.2019.12.12.23.03.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Dec 2019 23:03:41 -0800 (PST) Date: Fri, 13 Dec 2019 02:03:34 -0500 From: "Michael S. Tsirkin" To: Alexander Duyck Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, willy@infradead.org, mhocko@kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, mgorman@techsingularity.net, vbabka@suse.cz, yang.zhang.wz@gmail.com, nitesh@redhat.com, konrad.wilk@oracle.com, david@redhat.com, pagupta@redhat.com, riel@surriel.com, lcapitulino@redhat.com, dave.hansen@intel.com, wei.w.wang@intel.com, aarcange@redhat.com, pbonzini@redhat.com, dan.j.williams@intel.com, alexander.h.duyck@linux.intel.com, osalvador@suse.de Subject: Re: [PATCH v15 5/7] virtio-balloon: Pull page poisoning config out of free page hinting Message-ID: <20191213020316-mutt-send-email-mst@kernel.org> References: <20191205161928.19548.41654.stgit@localhost.localdomain> <20191205162247.19548.38842.stgit@localhost.localdomain> MIME-Version: 1.0 In-Reply-To: <20191205162247.19548.38842.stgit@localhost.localdomain> X-MC-Unique: iusZm2aBM-Ce35SWRr3Xsg-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Dec 05, 2019 at 08:22:47AM -0800, Alexander Duyck wrote: > From: Alexander Duyck >=20 > Currently the page poisoning setting wasn't being enabled unless free pag= e > hinting was enabled. However we will need the page poisoning tracking log= ic > as well for free page reporting. As such pull it out and make it a separa= te > bit of config in the probe function. >=20 > In addition we need to add support for the more recent init_on_free featu= re > which expects a behavior similar to page poisoning in that we expect the > page to be pre-zeroed. >=20 > Reviewed-by: David Hildenbrand > Signed-off-by: Alexander Duyck Acked-by: Michael S. Tsirkin > --- > drivers/virtio/virtio_balloon.c | 23 +++++++++++++++++------ > 1 file changed, 17 insertions(+), 6 deletions(-) >=20 > diff --git a/drivers/virtio/virtio_balloon.c b/drivers/virtio/virtio_ball= oon.c > index 15b7f1d8c334..252591bc7e01 100644 > --- a/drivers/virtio/virtio_balloon.c > +++ b/drivers/virtio/virtio_balloon.c > @@ -849,7 +849,6 @@ static int virtio_balloon_register_shrinker(struct vi= rtio_balloon *vb) > static int virtballoon_probe(struct virtio_device *vdev) > { > =09struct virtio_balloon *vb; > -=09__u32 poison_val; > =09int err; > =20 > =09if (!vdev->config->get) { > @@ -916,11 +915,20 @@ static int virtballoon_probe(struct virtio_device *= vdev) > =09=09=09=09=09=09 VIRTIO_BALLOON_CMD_ID_STOP); > =09=09spin_lock_init(&vb->free_page_list_lock); > =09=09INIT_LIST_HEAD(&vb->free_page_list); > -=09=09if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_PAGE_POISON)) { > +=09} > +=09if (virtio_has_feature(vdev, VIRTIO_BALLOON_F_PAGE_POISON)) { > +=09=09/* Start with poison val of 0 representing general init */ > +=09=09__u32 poison_val =3D 0; > + > +=09=09/* > +=09=09 * Let the hypervisor know that we are expecting a > +=09=09 * specific value to be written back in balloon pages. > +=09=09 */ > +=09=09if (!want_init_on_free()) > =09=09=09memset(&poison_val, PAGE_POISON, sizeof(poison_val)); > -=09=09=09virtio_cwrite(vb->vdev, struct virtio_balloon_config, > -=09=09=09=09 poison_val, &poison_val); > -=09=09} > + > +=09=09virtio_cwrite(vb->vdev, struct virtio_balloon_config, > +=09=09=09 poison_val, &poison_val); > =09} > =09/* > =09 * We continue to use VIRTIO_BALLOON_F_DEFLATE_ON_OOM to decide if a > @@ -1021,7 +1029,10 @@ static int virtballoon_restore(struct virtio_devic= e *vdev) > =20 > static int virtballoon_validate(struct virtio_device *vdev) > { > -=09if (!page_poisoning_enabled()) > +=09/* Tell the host whether we care about poisoned pages. */ > +=09if (!want_init_on_free() && > +=09 (IS_ENABLED(CONFIG_PAGE_POISONING_NO_SANITY) || > +=09 !page_poisoning_enabled())) > =09=09__virtio_clear_bit(vdev, VIRTIO_BALLOON_F_PAGE_POISON); > =20 > =09__virtio_clear_bit(vdev, VIRTIO_F_IOMMU_PLATFORM);