From patchwork Tue Feb 11 22:51:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Duyck X-Patchwork-Id: 11377067 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B773B14E3 for ; Tue, 11 Feb 2020 22:51:34 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 836042082F for ; Tue, 11 Feb 2020 22:51:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EqmHEL7y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 836042082F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BF1186B035F; Tue, 11 Feb 2020 17:51:33 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id BC8C66B0361; Tue, 11 Feb 2020 17:51:33 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AB8726B0362; Tue, 11 Feb 2020 17:51:33 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0198.hostedemail.com [216.40.44.198]) by kanga.kvack.org (Postfix) with ESMTP id 892FB6B035F for ; Tue, 11 Feb 2020 17:51:33 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 299E6180AD802 for ; Tue, 11 Feb 2020 22:51:33 +0000 (UTC) X-FDA: 76479344466.28.bomb96_47af25776e508 X-Spam-Summary: 2,0,0,73abcd820d70dff2,d41d8cd98f00b204,alexander.duyck@gmail.com,:virtio-dev@lists.oasis-open.org:kvm@vger.kernel.org:mst@redhat.com:david@redhat.com:linux-kernel@vger.kernel.org::akpm@linux-foundation.org:yang.zhang.wz@gmail.com:pagupta@redhat.com:konrad.wilk@oracle.com:nitesh@redhat.com:riel@surriel.com:willy@infradead.org:lcapitulino@redhat.com:dave.hansen@intel.com:wei.w.wang@intel.com:aarcange@redhat.com:pbonzini@redhat.com:dan.j.williams@intel.com:mhocko@kernel.org:mgorman@techsingularity.net:alexander.h.duyck@linux.intel.com:vbabka@suse.cz:osalvador@suse.de,RULES_HIT:41:152:355:379:960:965:966:967:973:988:989:1260:1277:1311:1313:1314:1345:1359:1431:1437:1515:1516:1518:1535:1541:1593:1594:1711:1730:1747:1777:1792:2196:2199:2393:2525:2559:2563:2682:2685:2693:2859:2918:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3353:3865:3866:3867:3868:3870:3871:3872:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4321:4385:4390:4395 :5007:61 X-HE-Tag: bomb96_47af25776e508 X-Filterd-Recvd-Size: 5367 Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Tue, 11 Feb 2020 22:51:32 +0000 (UTC) Received: by mail-wr1-f67.google.com with SMTP id t2so14645083wrr.1 for ; Tue, 11 Feb 2020 14:51:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:date:message-id:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=IOMlbjfXWuE+0u1ners+vpffTKgzzJDssD1Ouo69X0c=; b=EqmHEL7y0QA2mqPEAqNBo3EgWQVzlqdF9y2t1wKN6PRG19ziObA6wDoKpFUh4SvKoW JIoBJOMevTGYbyetGQWgQuRDrtj2apJTSBrrgiKrUyT8ACmpgeyOyf05wGeThVJwQ8ra iEzwxO72XwKzR7K8P9+XUPv/0z9RWpsCtZF/sD1Zj8A0OHrJg14V/LLV8jKDkidNv+4u gzRtI6WebEcA75xwVcH5PdmA8LUkM2wrL8EtpHLePZBGhVspRCBbjOO/Yq4tEAcOVS2z M07L2pq6fKNMQ8JKIz/QhLY/pVehO3b95DspSwcM6KezGAsVEU2jVWwRSiIRMQDvpYcN CmTw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:date:message-id:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=IOMlbjfXWuE+0u1ners+vpffTKgzzJDssD1Ouo69X0c=; b=iI9oCT6E4IKBFJzv0gQU7rPwBzeU/5j/DGEnGSRnG3mGpEub4Vly/PHYbuiqZaixyA ZzXsLQDlZsgzXvs9GT3GfPQ3zVz5gb2LZH9HBIxdm8LvjfkDzkNgfFSZ2BwBoJ6M79ue mbIsjrjHG4y1OVUAvaEJSLbVzz49F+2WoxJBhd72bFLYBuvLgqFg0xUf+0Pn6V17/FnG ymIcLT7UsF0girOpXgYwvZcteFZ7Teg2XWpGmHeyJxb9qfR5nyvHtcLYjhrHrU1ph53Z SgQgUJmQ5aazsOSKoV9ZQUxx3CXrZbX0Yp1EJ1ap3UUa48kxMxsbpgg2oxIiFjDfqZiW Gl5w== X-Gm-Message-State: APjAAAVI/RXufysFa9QrW2NDEOhkPZFN5FlotuPjgfAiFOHK7aEwnTIV O8w5IPT9GbgvpXz91HkPfZI= X-Google-Smtp-Source: APXvYqx+93e8f6Snf8Nwn26W6HHkSao0doTNZ1FIT+zSN0DdE7/fhQjcDfKypFQyi4PFtnreFzPiRg== X-Received: by 2002:a5d:4e0a:: with SMTP id p10mr11687705wrt.229.1581461491313; Tue, 11 Feb 2020 14:51:31 -0800 (PST) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id k16sm7418136wru.0.2020.02.11.14.51.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Feb 2020 14:51:30 -0800 (PST) Subject: [PATCH v17 QEMU 2/3] virtio-balloon: Add support for providing free page reports to host From: Alexander Duyck To: virtio-dev@lists.oasis-open.org, kvm@vger.kernel.org, mst@redhat.com, david@redhat.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org Cc: yang.zhang.wz@gmail.com, pagupta@redhat.com, konrad.wilk@oracle.com, nitesh@redhat.com, riel@surriel.com, willy@infradead.org, lcapitulino@redhat.com, dave.hansen@intel.com, wei.w.wang@intel.com, aarcange@redhat.com, pbonzini@redhat.com, dan.j.williams@intel.com, mhocko@kernel.org, mgorman@techsingularity.net, alexander.h.duyck@linux.intel.com, vbabka@suse.cz, osalvador@suse.de Date: Tue, 11 Feb 2020 14:51:25 -0800 Message-ID: <20200211225125.30409.98370.stgit@localhost.localdomain> In-Reply-To: <20200211224416.29318.44077.stgit@localhost.localdomain> References: <20200211224416.29318.44077.stgit@localhost.localdomain> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 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: From: Alexander Duyck Add support for the page reporting feature provided by virtio-balloon. Reporting differs from the regular balloon functionality in that is is much less durable than a standard memory balloon. Instead of creating a list of pages that cannot be accessed the pages are only inaccessible while they are being indicated to the virtio interface. Once the interface has acknowledged them they are placed back into their respective free lists and are once again accessible by the guest system. Unlike a standard balloon we don't inflate and deflate the pages. Instead we perform the reporting, and once the reporting is completed it is assumed that the page has been dropped from the guest and will be faulted back in the next time the page is accessed. This patch is a subset of the UAPI patch that was submitted for the Linux kernel. The original patch can be found at: https://lore.kernel.org/lkml/20200211224657.29318.68624.stgit@localhost.localdomain/ Signed-off-by: Alexander Duyck --- include/standard-headers/linux/virtio_balloon.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/standard-headers/linux/virtio_balloon.h b/include/standard-headers/linux/virtio_balloon.h index 9375ca2a70de..1c5f6d6f2de6 100644 --- a/include/standard-headers/linux/virtio_balloon.h +++ b/include/standard-headers/linux/virtio_balloon.h @@ -36,6 +36,7 @@ #define VIRTIO_BALLOON_F_DEFLATE_ON_OOM 2 /* Deflate balloon on OOM */ #define VIRTIO_BALLOON_F_FREE_PAGE_HINT 3 /* VQ to report free pages */ #define VIRTIO_BALLOON_F_PAGE_POISON 4 /* Guest is using page poisoning */ +#define VIRTIO_BALLOON_F_REPORTING 5 /* Page reporting virtqueue */ /* Size of a PFN in the balloon interface. */ #define VIRTIO_BALLOON_PFN_SHIFT 12