Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp29295539rwd; Wed, 5 Jul 2023 09:46:01 -0700 (PDT) X-Google-Smtp-Source: APBJJlE3ovGXQTHpWMGU2JE/8qMyj3AnZSWmju3X22VhB3yXLtjVw5RlGCIv0PBrHzjxX/NwJ4sL X-Received: by 2002:a05:6808:130d:b0:3a3:94f4:adca with SMTP id y13-20020a056808130d00b003a394f4adcamr15157248oiv.2.1688575561633; Wed, 05 Jul 2023 09:46:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688575561; cv=none; d=google.com; s=arc-20160816; b=0JrUK9m42CNVaZzrNllknJN766XVP/64OZLRnKGJ+1a28CrQYdWBPFbzoG/n4RBsLS Lnz5QsGPbCLJumanUCMrSg7jFhgWtyMwbNLIhC9XZErQtgvg+Ao3Aa/vZVmLIwFYmx1h VB7Zcmp78AT9bKlzSnWIb7MebmyNdzGjWkP0meHEsXmstQDOpe1kDin5KCrblAQw3y8i Q6JkFHRTyk7xqA/8iKVfJb49gwI2OPYb0/vUjKaQfh2awZVw+xGNc4v+siNugiEZYcnp k+VI6XdqG49P595JHmpe4aOW6hYWD2rjpRwMEjhmYsoGmqdfr6fn9rSK2SSE2Ehk96ge VKeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=qtdlmeuUvVV5AoG6i2ieA0Vy+QvgXsh2syFJ86sdKyc=; fh=jstJzqPXlyB1/5on9hwdG/WwGIvuQQ+XKaE5FzcZpLk=; b=CXgcX7WBSJVG1N7ypb7p1ene22pDCT6VzrfDMrpt6Br9an5HlLtyD8kFqaiJCu5vbx bthbO9HW/5AS/Qpto1vLWOQn5zQ60fIzhzbjNkacBUGhej7lQA+kqUMxcRbsKRGKbhTu X673ZyYLSzGsRvhz0BD9OboSOzQT4YzDDZi5uJMFz9pC6JVGMxljqjUQDtPzBwZi3Zdh YRdbErGDQF/x5tdpX2ueImbpER/lGyNHomxEbjMW+fjklx6yvA5iI5HG4M4MsbZ0Ycjt Ede2R9p16RmJRk6SQIehVfS9rphWISGG6otfgz8D/RAiBv8SjZEMugmJUB39TVwmmbmu 06UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Y0e6AiZ/"; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m9-20020a654389000000b005573b42d9e3si22945458pgp.593.2023.07.05.09.45.49; Wed, 05 Jul 2023 09:46: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=@redhat.com header.s=mimecast20190719 header.b="Y0e6AiZ/"; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231908AbjGEQjM (ORCPT + 99 others); Wed, 5 Jul 2023 12:39:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231741AbjGEQjL (ORCPT ); Wed, 5 Jul 2023 12:39:11 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EFE71703 for ; Wed, 5 Jul 2023 09:38:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688575108; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qtdlmeuUvVV5AoG6i2ieA0Vy+QvgXsh2syFJ86sdKyc=; b=Y0e6AiZ/c+MsCLGcSjlJStGzpWQyzBAHbpTcihLAussMioXbDB7KsFi5ATHvGtRsr0sF6I VP4TSDDgxMY9JHHK4UZZhGsmq+JLp5eM/3wSYqH4WUICsJarPQhN6ZFcdK5TEag5hRNVQD mFfOM0flpB5AlJBJiq7ijK9tvdNZFsw= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-36-WZAI8yadMZ2a0BN9C7zZgw-1; Wed, 05 Jul 2023 12:38:27 -0400 X-MC-Unique: WZAI8yadMZ2a0BN9C7zZgw-1 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-403838e9f4dso707821cf.1 for ; Wed, 05 Jul 2023 09:38:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688575107; x=1691167107; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qtdlmeuUvVV5AoG6i2ieA0Vy+QvgXsh2syFJ86sdKyc=; b=IOLKMIQ5vXPGPnFHptEjsWnrex/UOIu+GqQwjMPK3jxqJqJBADqTyEBEafPEea64jv 2bbODsy4PdSZosOJIcDIxcI9dG4z8onoyxdnhAO8CrJfh5h5MDaWC03vr4nUUOVEZ8fq eo5yiwfNPdJxF9Y4be2HOCKGzhAQ/NpDOV86YdIJ5s0YyIcWGXYc/JuyMer4zeZ624yM 5GLBMhEP5KHEqJdD7cB1zAwP3jlgK/+6YY4+dp+Dxd8ymLIQLV2WMff45uNkm6YdPbdm uN7kLrQslTp8OFwVkPwWP1HB4m0UWWAWPVdH99fIt8CVUFUBq6DREGDfgE6MykM8KRRU JsZg== X-Gm-Message-State: AC+VfDyAHvsLcPghD2w9dWW3Bw0TM6N6LA58sG5q6etiWYceDxmTVQI9 ecFb+p8F+onONBy6a7sqNNYCw9K9WpV+rYThcYDS9P7eJi874yLnGlmwdHoVXScEQwOjoUeR+JZ PoI3Q78AwhuvFy9CKEfDjZKlP X-Received: by 2002:a05:622a:1649:b0:3fd:e953:74ee with SMTP id y9-20020a05622a164900b003fde95374eemr23330967qtj.2.1688575106973; Wed, 05 Jul 2023 09:38:26 -0700 (PDT) X-Received: by 2002:a05:622a:1649:b0:3fd:e953:74ee with SMTP id y9-20020a05622a164900b003fde95374eemr23330935qtj.2.1688575106709; Wed, 05 Jul 2023 09:38:26 -0700 (PDT) Received: from x1n (cpe5c7695f3aee0-cm5c7695f3aede.cpe.net.cable.rogers.com. [99.254.144.39]) by smtp.gmail.com with ESMTPSA id ew5-20020a05622a514500b00400a760cbfdsm12611511qtb.17.2023.07.05.09.38.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jul 2023 09:38:26 -0700 (PDT) Date: Wed, 5 Jul 2023 12:38:24 -0400 From: Peter Xu To: James Houghton 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 Subject: Re: [PATCH v2 1/6] mm: userfaultfd: add new UFFDIO_POISON ioctl Message-ID: References: <20230629205040.665834-1-axelrasmussen@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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 05, 2023 at 09:27:15AM -0700, James Houghton wrote: > On Wed, Jul 5, 2023 at 9:15 AM 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 needed? > > > > > > > > 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_HWPOISON > > 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. Miaohe initially proposed this swapin error facility, let's see whether he can comment; he's already in the cc list. AFAICT that's the right thing to do, and it shouldn't affect any existing user of swapin error if there is. Or say, VM_FAULT_HWPOISON should be the same as VM_FAULT_SIGBUS when not in kvm context, so shouldn't change a thing in !kvm, while changing that should fix kvm from crashing a guest where we shouldn't need to. -- Peter Xu