From patchwork Fri Jan 3 21:21:14 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Duyck X-Patchwork-Id: 11317453 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 DA5F81395 for ; Fri, 3 Jan 2020 21:21:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A794E222C3 for ; Fri, 3 Jan 2020 21:21:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="IReGa2gp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A794E222C3 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 DEE978E0007; Fri, 3 Jan 2020 16:21:17 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D9FCA8E0003; Fri, 3 Jan 2020 16:21:17 -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 CB5CB8E0007; Fri, 3 Jan 2020 16:21:17 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0063.hostedemail.com [216.40.44.63]) by kanga.kvack.org (Postfix) with ESMTP id B75418E0003 for ; Fri, 3 Jan 2020 16:21:17 -0500 (EST) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 67F948249980 for ; Fri, 3 Jan 2020 21:21:17 +0000 (UTC) X-FDA: 76337593794.01.rose35_4565734b10659 X-Spam-Summary: 2,0,0,ac2829166299b50f,d41d8cd98f00b204,alexander.duyck@gmail.com,:virtio-dev@lists.oasis-open.org:kvm@vger.kernel.org:mst@redhat.com:linux-kernel@vger.kernel.org:willy@infradead.org:mhocko@kernel.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,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: rose35_4565734b10659 X-Filterd-Recvd-Size: 5374 Received: from mail-pg1-f196.google.com (mail-pg1-f196.google.com [209.85.215.196]) by imf22.hostedemail.com (Postfix) with ESMTP for ; Fri, 3 Jan 2020 21:21:16 +0000 (UTC) Received: by mail-pg1-f196.google.com with SMTP id b9so23926164pgk.12 for ; Fri, 03 Jan 2020 13:21:16 -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=S67ROGEQCcp+6ozGSJjGTXgu/nEqa4BuBwrMv8wLSMo=; b=IReGa2gpjzbzT0DsrzpVX4qSADu6S+wBF/3HbzQ38dE/yvPaRm79BSAATDSruM5kwO TIidBoo1i73CWujrF0OeIRZd0YQ5WzAE3H2eyU+sju2ugoESBnpg4FOJxoh0meQNodz/ QPcpExtgV33WERambn2oj57Od9YVHVuq7jaHpYiC6rgRkn6APMqmI/wmzYgrqBl5Xuq7 zKMLN8iW1k2J2PMzgPPULqG/EQE/bOebpzRdeS7szwKV25U74c2SJp/gBGw/GxANc14N QxzER9uQWzXPYKgg6YT4iT7rKGg+mGn7QnNvHGOvmZF32Avp366kDbZd1vb/B2XVHuJF o1+w== 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=S67ROGEQCcp+6ozGSJjGTXgu/nEqa4BuBwrMv8wLSMo=; b=OZB3CJPNr4g8kDFtEmoepHqlOJ7kbUiuegjwa30MgFmy/dRaZ5l5hSFZ4ES9YldDPA saW4Cw2FqAgfyIs7lfubacJkYBd4o1oqbWd8jyJrlaHClq913jj5FwGXC7XtHd5EaNpE fb9ymzdlvj5wCxNZV3t1p6dGphrWX6fBxx6xb+quOje9W5T14z3bZtyuJ8zw9tdNIzg5 FjiF2F9x91j/ADe1Wia8f9mhj4pP7+7PyihKFkdYY5+EBRaARcuwjVdGn3rPIsVAZ3/v ObeW034skjNSN0JEZy9ueFOxlAkDuLqWb4RSGlGpCxlKtX54MUfj+xxcnPCbnLCALewc RW8g== X-Gm-Message-State: APjAAAWM98QVM6+gOiMwKWnsHb6zq/9CUrWuT6yKRAY+nshnMP+fVMK7 FhiGAp8eJo+Wui8Bthju9yI= X-Google-Smtp-Source: APXvYqzpGZPeSqmK+zMTQ5LdDqI3o5o9Ha0+h7iu+L/6VZ89kc7BfukT01TLxUdVF4Ok/9jq0oZijg== X-Received: by 2002:aa7:951c:: with SMTP id b28mr94501152pfp.97.1578086475886; Fri, 03 Jan 2020 13:21:15 -0800 (PST) Received: from localhost.localdomain ([2001:470:b:9c3:9e5c:8eff:fe4f:f2d0]) by smtp.gmail.com with ESMTPSA id q63sm46101348pfb.149.2020.01.03.13.21.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Jan 2020 13:21:15 -0800 (PST) Subject: [PATCH v16 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, 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 Cc: 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 Date: Fri, 03 Jan 2020 13:21:14 -0800 Message-ID: <20200103212114.29681.69388.stgit@localhost.localdomain> In-Reply-To: <20200103210509.29237.18426.stgit@localhost.localdomain> References: <20200103210509.29237.18426.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/20200103211651.29237.84528.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