Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp29292304rwd; Wed, 5 Jul 2023 09:43:01 -0700 (PDT) X-Google-Smtp-Source: APBJJlFQqe1YWUAeRszQsHe2klFCI3Kzkky0tgoDoP/LB+WPNCm32GE1bzxg/SZlnALe81gnTT7C X-Received: by 2002:a05:6a00:c8f:b0:66c:a45:f00b with SMTP id a15-20020a056a000c8f00b0066c0a45f00bmr25144307pfv.23.1688575381668; Wed, 05 Jul 2023 09:43:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688575381; cv=none; d=google.com; s=arc-20160816; b=bGfF7sN3daYIWcMQfYbyXmbwajVSguKX/+O2J09lkDHmEizylIlLVK7JSH0Sa8E/4s aFw3aiKdBYZqzrtnPIrC2QDel3eKYrO4+QJShCA44xcW+OhyAKgB7y/iKThP0Xyj60Cf thQRqofHC/XQolIevCYwy97nQMW9cy/9tkgg7BZ3l+4mYjHeKEQEoB3E6StUk1P/SA2M cWJdkeX6zGPIJ/EPJLHcwXzZFLo/SSxTs7Qt/JbcW/Qe6ay1Q+3pwtYy8bpDUrwHarFN iLz+UUSAVFvfcTFvXsAF/7i6upvEq7P1tkHk0Kwdn1FuYH+YTUkFNDaXuo6/Q//IUApP 9AqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=6+b6HdBO2HTE2Fgq56si0I6hn366dTE1zq4yHg6W9Y0=; fh=jcEjeKRajauK11npVBVfUbSbnAMPfD6L+umxy+/Itvs=; b=CWtwClOKWvwRP7ZEDl5N3B+YtET8Rk4JoSUuuneX1ke3p8fssuKFzMIoNjYflDs84j ZX+6yVO3bzoTi7mgD2zrZyf9RtKvmmTvUf/Rs8HYamQOnp4AjaT+a7MK4Ndd2sjN6L24 knOdA85QY9l1SFa85jtmry1A2IYdtR9tbJ54kRh/IucGyu5wHXP+4pEKPObPtLj53glP Ir321igNzAHyLsb32FERARZUtAw99UwSyDGS0nlhz2etA8dAL77V3qWUvESFZgmIZJQq Io5DIFQBHN9OH+ocii5TgHIfxVqQ06DqTpxfCwRrI8P9toTisN+v9/Q5VxMd0GCztYbZ LB1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=DyQIomzb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s13-20020a056a00194d00b0068225e629aesi15055467pfk.0.2023.07.05.09.42.49; Wed, 05 Jul 2023 09:43:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=DyQIomzb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231847AbjGEQ14 (ORCPT + 99 others); Wed, 5 Jul 2023 12:27:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232819AbjGEQ1x (ORCPT ); Wed, 5 Jul 2023 12:27:53 -0400 Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FEEF1703 for ; Wed, 5 Jul 2023 09:27:52 -0700 (PDT) Received: by mail-qt1-x82c.google.com with SMTP id d75a77b69052e-40371070eb7so452251cf.1 for ; Wed, 05 Jul 2023 09:27:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1688574471; x=1691166471; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=6+b6HdBO2HTE2Fgq56si0I6hn366dTE1zq4yHg6W9Y0=; b=DyQIomzb0HGOrjSSZzDc25EbIFtjXS02c4XUBPZ89883pZrEXwEqIvAqTPU5izH4tI YzCv1bHM84pr9hrlxKNebT/aMAWEgU3frR2KZs+O82khTXgvFU6GKExm2m8fgSwVZTs4 N39yAxRq/LR4kfzHKjQ0el059sAmyDJchQJczSYHkJC8BKElkfESrFOV0WHqSP6P/ugT luZXSTTdIk1EcOK7bzX/Nmoey5akNpKPAGMDet04pI/vuQjxeDl89JFrRizqnnzdAqv+ +YJyEP+IyDmcRoyrqFke90XH4sLRTtB/CQJ+g9SKiCkYmIYqjAatKt5PLteziZEuBq5g RNxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688574471; x=1691166471; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6+b6HdBO2HTE2Fgq56si0I6hn366dTE1zq4yHg6W9Y0=; b=M0b0cThM+EchGms4diDwf3Rza2N2XRgDXFTCCQKz+OulSYwqpboDgMghXuwhZka8Yd R/tn5vrv7RjKc8IXQGgEr8ILvJTANZA4Xhjve0prN3R2ACAY3DBqUYdpFmnkPNwE4RVO CjgqpMEh8xti/DqjalHS7MYefBpAlkilwDoiHjtNpr8ZyS7KjwdsRTT6h4uEoTLjYBxy kRtTJlaZ5sNJ/+0yd1wTCSA02/kjW5ZN9txElfCgSSrU5Uhqy2rneu+z2eglDNHegT3Q 0WScrSRJcouPXwXbuY6o4BYX4gy2JbM+pM1i85QYQe12IuQvdBbONzWKCR6sivRFeE/N DBIw== X-Gm-Message-State: ABy/qLZ8y0Uj9PL6vYDayn5fAnCcw3x3CXhRLrIsMs7P7hEC2NMObAx/ XbCCDHis/oQg7jq54nUueib0TtS8ip+Tg6CVRnrslw== X-Received: by 2002:a05:622a:2d6:b0:3f8:5b2:aef4 with SMTP id a22-20020a05622a02d600b003f805b2aef4mr135081qtx.28.1688574471033; Wed, 05 Jul 2023 09:27:51 -0700 (PDT) MIME-Version: 1.0 References: <20230629205040.665834-1-axelrasmussen@google.com> In-Reply-To: From: James Houghton Date: Wed, 5 Jul 2023 09:27:15 -0700 Message-ID: Subject: Re: [PATCH v2 1/6] mm: userfaultfd: add new UFFDIO_POISON ioctl To: Peter Xu Cc: Axel Rasmussen , Alexander Viro , Andrew Morton , Christian Brauner , David Hildenbrand , Huang Ying , Hugh Dickins , Jiaqi Yan , Jonathan Corbet , "Liam R. Howlett" , Miaohe Lin , Mike Kravetz , "Mike Rapoport (IBM)" , Muchun Song , Nadav Amit , Naoya Horiguchi , Shuah Khan , ZhangPeng , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 5, 2023 at 9:15=E2=80=AFAM Peter Xu wrote: > > On Wed, Jul 05, 2023 at 09:09:19AM -0700, James Houghton wrote: > > > > diff --git a/include/linux/swapops.h b/include/linux/swapops.h > > > > index 4c932cb45e0b..8259fee32421 100644 > > > > --- a/include/linux/swapops.h > > > > +++ b/include/linux/swapops.h > > > > @@ -394,7 +394,8 @@ typedef unsigned long pte_marker; > > > > > > > > #define PTE_MARKER_UFFD_WP BIT(0) > > > > #define PTE_MARKER_SWAPIN_ERROR BIT(1) > > > > -#define PTE_MARKER_MASK (BIT(2) - 1) > > > > +#define PTE_MARKER_UFFD_POISON BIT(2) > > > > > > One more tab. > > > > > > Though I remembered the last time we discussed IIRC we plan to rename > > > SWAPIN_ERROR and reuse it, could you explain why a new bit is still n= eeded? > > > > > > I think I commented this but I'll do it again: IIUC any existing host > > > swapin errors for guest pages should be reported as MCE too, afaict, > > > happened in kvm context. > > > > I think swapin errors are treated differently than poison. Swapin > > errors get VM_FAULT_SIGBUS, and poison gets VM_FAULT_HWPOISON, so > > UFFDIO_POISON should also get VM_FAULT_HWPOISON (so that's what Axel > > has implemented). And I think that needs a separate PTE marker. > > My question was, should we also make SWAPIN_ERROR return VM_FAULT_HWPOISO= N > always? > > Just to recap from what I already commented above - if a guest page got > error in swapin due to block sector failures, it should be treated as > VM_FAULT_HWPOISON too, IMHO. IOW, I think current SWAPIN_ERROR is wrong > when in kvm context and we should fix it first. Oh! Yes, I agree, though I'm not familiar enough with the users of SWAPIN_ERROR to know if we can actually make this change.