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=-8.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 BBD0FC433E6 for ; Mon, 15 Feb 2021 12:22:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6B4B664E32 for ; Mon, 15 Feb 2021 12:22:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6B4B664E32 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 44AC78D00E6; Mon, 15 Feb 2021 07:22:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3F72D8D00F5; Mon, 15 Feb 2021 07:22:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 29C568D00E6; Mon, 15 Feb 2021 07:22:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0109.hostedemail.com [216.40.44.109]) by kanga.kvack.org (Postfix) with ESMTP id F263A8D00F5 for ; Mon, 15 Feb 2021 07:21:59 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id B73888248068 for ; Mon, 15 Feb 2021 12:21:59 +0000 (UTC) X-FDA: 77820413958.27.flock21_34036342763b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 9C3DC3D663 for ; Mon, 15 Feb 2021 12:21:59 +0000 (UTC) X-HE-Tag: flock21_34036342763b X-Filterd-Recvd-Size: 3435 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf17.hostedemail.com (Postfix) with ESMTP for ; Mon, 15 Feb 2021 12:21:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613391718; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=y+tCfh7p5rS93AyYcRTEfar0U9kSrmpYDnZc3YNOM60=; b=adUrT3kfc/I+0OJyJj8sD3gHHHfHegmBKfMTPmd79pMGhOG9ZhUkGn6EY5sYfi6VfBRUnq 1oOcKww97UScqWng5crfCDL5HgQHhFg8HdtE/XM1a9lVr/Z8T1T7x/3aZNkupYQ9KRncDe UrKVRf/BlK7cJo9WrKNfsLkqaBfFkas= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-40-zZCEY8pSOaaGROwdy9wW1Q-1; Mon, 15 Feb 2021 07:21:54 -0500 X-MC-Unique: zZCEY8pSOaaGROwdy9wW1Q-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 88A32192CC45; Mon, 15 Feb 2021 12:21:52 +0000 (UTC) Received: from t480s.redhat.com (ovpn-114-89.ams2.redhat.com [10.36.114.89]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A0362BFEC; Mon, 15 Feb 2021 12:21:44 +0000 (UTC) From: David Hildenbrand To: linux-kernel@vger.kernel.org Cc: virtualization@lists.linux-foundation.org, linux-mm@kvack.org, David Hildenbrand , "Boeuf, Sebastien" , Hui Zhu , Jason Wang , Marek Kedzierski , "Michael S. Tsirkin" , Pankaj Gupta , Wei Yang Subject: [PATCH v1 0/2] virito-mem: one fix and VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE Date: Mon, 15 Feb 2021 13:21:41 +0100 Message-Id: <20210215122143.27608-1-david@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Content-Transfer-Encoding: quoted-printable 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: One minor fix and introduction of / support for VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE. Looking into supporting file-based memory backends (shmem, hugetlbfs, ...= ) for virtio-mem in QEMU cleanly, I realized that we have to indicate that unplugged memory is completely inaccessible. Otherwise, Linux might in corner cases read unplugged memory, which is harder to support (and harde= r to protect from) in a hypervisor than with anonymous memory where we have a shared zeropage. To support VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE cleanly, we cannot (un)plu= g memory in SBM (Sub Block Mode) and instead, can only support adding/ removing individual Linux memory blocks (e.g., 128MB on x86-64). While we might still be able to allow for reading unplugged memory with file-based memory backends in the future (and I have plans/prototypes for it), at least in the near future we cannot support it. David Hildenbrand (2): virtio-mem: don't read big block size in SBM virtio-mem: support VIRTIO_MEM_F_UNPLUGGED_INACCESSIBLE drivers/virtio/virtio_mem.c | 27 ++++++++++++++++++++------- include/uapi/linux/virtio_mem.h | 10 +++++++--- 2 files changed, 27 insertions(+), 10 deletions(-) --=20 2.29.2