From patchwork Thu Jun 29 20:50:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Rasmussen X-Patchwork-Id: 13297316 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74885EB64D9 for ; Thu, 29 Jun 2023 20:51:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3AE838D0008; Thu, 29 Jun 2023 16:51:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C2B18D0001; Thu, 29 Jun 2023 16:51:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 118008D0008; Thu, 29 Jun 2023 16:51:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id E9EFD8D0001 for ; Thu, 29 Jun 2023 16:50:59 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id BEE571A0CEA for ; Thu, 29 Jun 2023 20:50:59 +0000 (UTC) X-FDA: 80956979838.03.32716C3 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf19.hostedemail.com (Postfix) with ESMTP id 027F81A000B for ; Thu, 29 Jun 2023 20:50:57 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=vd6FO9RK; spf=pass (imf19.hostedemail.com: domain of 3se6dZA0KCDIOlSZfOgaiggSbUccUZS.QcaZWbil-aaYjOQY.cfU@flex--axelrasmussen.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3se6dZA0KCDIOlSZfOgaiggSbUccUZS.QcaZWbil-aaYjOQY.cfU@flex--axelrasmussen.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1688071858; h=from:from:sender: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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=yLzMk6njG0VUm6oo8ECi7NNqjOvlkj+YcLB9LCE7+MA=; b=ndym8xE+fxU/QKtHjCxcMfyEi8ZKTQpvoxiWYuBHf1ifP/pnWLvZzPG8XWWPY/4l+/lvMq EO6GlTWigCSUsQEe5XDSPrIz8KWlH6yzWw+BQf54K78w61z6/osFjDlY7r7qZvn5g0YN8Z hP2TuXjc917xU0ITBjid50W+dne1G+k= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1688071858; a=rsa-sha256; cv=none; b=YplYXxN4y54D/oK8sEJrjYXY/CN/jxnzWUSw1jdfHLjSw7C+aJCH2se0tuNBsmGLba72Kz g0DOxwNw0au9iFfiorM/YOZ6vIeG0ReU//Od31ibr71oMO+15zTyEFnAbAXB9Adz7XK8XG vThPMSf10I45nCzRmuZPcpmnTZQv5ng= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20221208 header.b=vd6FO9RK; spf=pass (imf19.hostedemail.com: domain of 3se6dZA0KCDIOlSZfOgaiggSbUccUZS.QcaZWbil-aaYjOQY.cfU@flex--axelrasmussen.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3se6dZA0KCDIOlSZfOgaiggSbUccUZS.QcaZWbil-aaYjOQY.cfU@flex--axelrasmussen.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-c361777c7f7so1737595276.0 for ; Thu, 29 Jun 2023 13:50:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1688071857; x=1690663857; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=yLzMk6njG0VUm6oo8ECi7NNqjOvlkj+YcLB9LCE7+MA=; b=vd6FO9RKLDqV//QD3xfOnLM9ABYCd6dUPJXpRHT4NX5noS8/sUBwSo898iH3nVkB0i DtNAyV+Pi6bgq0S9jGXWkBhQ9/YdQKbSPEohpFeN8NdUWPbX25v+l+vYnpTa7r6jcPht dbVhBKQwNHFgV1WouNWGszv4XwOpqInDK4ouCSz6Ak/7s9gGDRqjeI3/ZhamBO61VWCa Z6gPSDN+iIv39tWkyOgXo6urQM1zLyzmqO53tLfzCPB+LOgT197q6GD2uuEhk9CDZuub vqBRd9kZ1XKyBS+VrCDyZJ59YXT8sSu0AY+uPtiN0Du5fb03DdmO0Rm9zeWUxhbXnaCv j0ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688071857; x=1690663857; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yLzMk6njG0VUm6oo8ECi7NNqjOvlkj+YcLB9LCE7+MA=; b=kc77S9KgrdLC2LM1WZNQfVY+Wk4/DUEWWoRzMMfoyn+bxNeIL6JaPDD24mvqN380wS 03mqretG3Tdu5byXi3RR8LY3HnXExHZz+rD0c/86PnEITD2UDy22JsckM61/3yxPWoYB /6+hG18XTURbJ99CiFwOew5d7H+ZOpzCtFsXfRwNv3SdKEpGnoPN3gzqH5gb4N5vqoux cLY15QLGSNJ9uvJlOJfIb6trC3yKe6ZAvaKBZHGNfSvuRR6tXLA0fz0vU3tf+1QZah6g s1iowz5mVK0FaaNqlrSumfJBUO5gCFaznAoKhDMpNNRgrJ5wr2jvhTk7WneXuyxpSARF g0Wg== X-Gm-Message-State: ABy/qLabWQVqjMq4pjPGthyQEN3XbKJtJEX9RrbllrKz2vsUDiSvW67M OYdvnbP1ScQIS+pc+WxGDcRXf2rPhTNbklU/vxyC X-Google-Smtp-Source: APBJJlFxXqx6n/8cIVb44SOqXuMVe8nfJc8KbVSjzubcNqQNTjaVwvxr+Cfitw1Wlj4qp7VAwfdaVDGWjSlIa4+NsAGc X-Received: from axel.svl.corp.google.com ([2620:15c:2a3:200:e20f:5917:3efa:d4bb]) (user=axelrasmussen job=sendgmr) by 2002:a05:6902:1105:b0:bc3:cdb7:4ec8 with SMTP id o5-20020a056902110500b00bc3cdb74ec8mr74829ybu.6.1688071857157; Thu, 29 Jun 2023 13:50:57 -0700 (PDT) Date: Thu, 29 Jun 2023 13:50:40 -0700 In-Reply-To: <20230629205040.665834-1-axelrasmussen@google.com> Mime-Version: 1.0 References: <20230629205040.665834-1-axelrasmussen@google.com> X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog Message-ID: <20230629205040.665834-6-axelrasmussen@google.com> Subject: [PATCH v2 6/6] mm: userfaultfd: add basic documentation for UFFDIO_POISON From: Axel Rasmussen To: Alexander Viro , Andrew Morton , Christian Brauner , David Hildenbrand , Huang Ying , Hugh Dickins , James Houghton , Jiaqi Yan , Jonathan Corbet , "Liam R. Howlett" , Miaohe Lin , Mike Kravetz , "Mike Rapoport (IBM)" , Muchun Song , Nadav Amit , Naoya Horiguchi , Peter Xu , Shuah Khan , ZhangPeng Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, Axel Rasmussen X-Rspamd-Queue-Id: 027F81A000B X-Rspam-User: X-Stat-Signature: 51qqkqa76qdd7fgk3rqo96yyd8nohxid X-Rspamd-Server: rspam03 X-HE-Tag: 1688071857-34783 X-HE-Meta: U2FsdGVkX1+D1AItIxGNu8KfQCoQwO3XZNr0mYj0QzI2xVc8xwoXrCJiqcWrF/mBQUSgHiezSPeS7Rg98k+moA0VyShaEUNqK4qhNx2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/xMWVsIFF1p8vDT1Q5stRMfV0Ojts5bwXcTOgHN8GhG5pqNSxDeVOG95l2txDKKzrkQapAVHNne/Es+IIU/e13Se6/eDOf8p6HOv3oDjfVCR/JiOSpIgUuDtVPpWW29XnUBuK4NTg1U5AXv5M9vfFnjChbznZb8sF9FcqPnqppk49dTDB7ep7T8w0yXQtjJgpZ9IJ44mH4hXe4TDRpmBjhFi0GrRywt4Q+0aAUb/YkRqHCifKTH+UynW7UR8rugWyFKCApIziXdV+h4twZ6bRwmY+wr5p/+BYAEvVcSrqrnFqZjbxA8fm8J/nEJv87RPFst2GPgmHIk4vQg+XY0k/no50D45K9APGLyqeIEjHSTslzbrdXkrD8/EbCofoEJYEr9x2o8uFA8AEwqBhzaTMTO2Z2BNgmKI/3YodO5hoia+NQhZzUgnwiKabiTnnEQsdRhzf7MIU/Eudn3v78Y26WYO/3I0hp04E+Wq6siuJBie7RmEU3oTAC2wkulpRIbiqsXfvr5pD9BmYs= 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: Just describe the feature at a really basic level. Signed-off-by: Axel Rasmussen Acked-by: Peter Xu --- Documentation/admin-guide/mm/userfaultfd.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Documentation/admin-guide/mm/userfaultfd.rst b/Documentation/admin-guide/mm/userfaultfd.rst index 7c304e432205..b19053436369 100644 --- a/Documentation/admin-guide/mm/userfaultfd.rst +++ b/Documentation/admin-guide/mm/userfaultfd.rst @@ -244,6 +244,21 @@ write-protected (so future writes will also result in a WP fault). These ioctls support a mode flag (``UFFDIO_COPY_MODE_WP`` or ``UFFDIO_CONTINUE_MODE_WP`` respectively) to configure the mapping this way. +Memory Poisioning Emulation +--------------------------- + +In response to a fault (either missing or minor), an action userspace can +take to "resolve" it is to issue a ``UFFDIO_POISON``. This will cause any +future faulters to either get a SIGBUS, or in KVM's case the guest will +receive an MCE as if there were hardware memory poisoning. + +This is used to emulate hardware memory poisoning. Imagine a VM running on a +machine which experiences a real hardware memory error. Later, we live migrate +the VM to another physical machine. Since we want the migration to be +transparent to the guest, we want that same address range to act as if it was +still poisoned, even though it's on a new physical host which ostentisbly +doesn't have a memory error in the exact same spot. + QEMU/KVM ========