Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2945552lqo; Tue, 14 May 2024 14:34:44 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWlVqZy9ws450ogylkEndnaVbFwR8ZE1r0fhq2lcGnranSPvJUyPYR3Oi/XOhMODeSllYWNmOo7mLmGoPWd1RljT4bBHcgwZFadzLFfDw== X-Google-Smtp-Source: AGHT+IFRXyAZcAriLsXb1bh9A9yCCU5OyqR9R5NQcdnvFdW7vKfz8o1OFU+0g9Q0X0dKYQ/Hg6Mx X-Received: by 2002:a5b:bc2:0:b0:de5:9d13:48b0 with SMTP id 3f1490d57ef6-dee4f30e578mr12800896276.1.1715722484555; Tue, 14 May 2024 14:34:44 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715722484; cv=pass; d=google.com; s=arc-20160816; b=Rh9Pdsiz7wPqbiDnOxfH7kOyllsKE9EW7nn/V6xC/bkpr2z5EbJEglSbGRn4/9pe93 IqpYA/2LkxXiM71sGxYpeRLyA3B2JUE4wdzctIisRZbHaR+BsGf4OKJ5jtVAqOeYtkRC eOGtFVQe9ABsCdCbTEIDUDvw3HW2oTK75gSJutK3zSG3wr5TiaVQE5TfyYqnaEn0TQ3S iKcqzIA91ZDMsp4Xz9yrXA954hxpIev6INX2TVf2UiKAOS326OJ8nGebjFI6kziQcqXm OkvCeXyXpHp9X2CpUITeIlk6cB+fWZMRRpHxtg2G/hnd7AcBPnsFVvvGu2HiYZHl/bO4 llDA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Q2Xu6ycBxA1ncNcxZjTIGSkpvUsVz0mp4Jxa+4CoWmo=; fh=0uF9fj6qFB+d5n6FoA0ifnQUSBLwX1j4Pgxs9BTtUzk=; b=LjXwCs7JQ8Fhf3BGPBoag3sWg5RH7i+IViDaQzBrRhEkIggGD3EFXBxwvADn6B27Vg S4FuY1TGIJfD7S6axgKKD4+XMcrTa1VHmnOyz+MrD3RnD+gWg+sIpd5vx++/pVFzMHkg E68dj1XzN5G4a/7nXcV0qCph8Sggd0jkS4jtrBkTXlSGfqs51xx81SMjuXpbIKRNvN7n QdLYDSH48f9q/fyIPQFhk+FYfANQERO7oqjWgZSt2+i3R2hZ+tbciKNekYbXsJPFL7d+ UwxAo6o6v1hb9o6/lJmfMwTRdz3FYgyRN63IHOSXHab/HrtLoAncI5Noz8O6L8c3ZStF VaEg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BTIT9KHw; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-179190-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179190-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-43df566f859si134870451cf.359.2024.05.14.14.34.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 14:34:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-179190-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=BTIT9KHw; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-179190-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-179190-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 298CA1C20D1C for ; Tue, 14 May 2024 21:34:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C7765181BA6; Tue, 14 May 2024 21:34:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="BTIT9KHw" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2D887180A77 for ; Tue, 14 May 2024 21:34:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715722477; cv=none; b=LqSJFx+6gh8eR9DFp1rr/RFyoLoPU7xLWN7ng0wx9mdBd54EBu3bd49r07BEYAvUgQqcKiuSs1cspwcoPjbsMYwBl2duK9zGy5Ky/OkxkhrMdwsHszqHp27Wqcj/6VD6N6m+APPteiQblVHkinTSuMwwmt1N9ROLXRWJeX2+qLY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715722477; c=relaxed/simple; bh=dg3D8jzXOepk90HJ2oawVVRby4i/Jql8l3UJpoy8uQg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RG9au8Pl+q0+wcmA+6HmG+qVG1IUKEzQfCih83jTtooDlHDmZ+f3xi9Yo5HM+U9uVVYkUbEwoYoGNOXpfCQkkcyWs7oKFqwu1sekEXdhX4w2EoCEGH0r8akeJoJT58HN+pXeUCTve3bVidNoP9OA9Vam/lDzPzloXBfsORewiaE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=BTIT9KHw; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1715722475; 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: in-reply-to:in-reply-to:references:references; bh=Q2Xu6ycBxA1ncNcxZjTIGSkpvUsVz0mp4Jxa+4CoWmo=; b=BTIT9KHw68mN4wCkOXqiaWaVuqqAC5cOpFTlCr7QNfcppPB8rDIGUjTJiGis4TBWK0wZ5S Gr0j+aBgTggMB27XKFXm1kq0WwFhDv70iQ8JrG55FMq8L9aYQQpTyywwcoSsIr70XpHFL/ MZvmKHMadcFzuw7q8Hjt5BtSQIUahsY= Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-637-2k4pTwKtNI2NtnTQd_m6Jg-1; Tue, 14 May 2024 17:34:33 -0400 X-MC-Unique: 2k4pTwKtNI2NtnTQd_m6Jg-1 Received: by mail-pj1-f69.google.com with SMTP id 98e67ed59e1d1-2b83ee6ef60so1484748a91.2 for ; Tue, 14 May 2024 14:34:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715722472; x=1716327272; h=in-reply-to: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=Q2Xu6ycBxA1ncNcxZjTIGSkpvUsVz0mp4Jxa+4CoWmo=; b=kQ7UA0wDwbgCUn8lXp+5mO0I0b+LRGyWQPd9a9Wr5YPM5WqzTlQV37712yiHDBzlTp htdoP9rn6DGtYdumWDUp0llvHPuMbtUe3AfDm0Xd9EwUJcLJHBvixAuMAi0jBoLWn6hw 5Eq4xWizbpDlE8rgKsx/W4hCc71JBNa6aRZqx+eXCVfAPNlTo4sd74kWTm638gqC2r/v l9tF4nK2tkFly5h6cMAsUjS/oPRZ4Akoc4q/AH78YJLXblt2DGmRgVFTv86vDEoQBRUS HpkxF2IfNeCL8mIGR8bt8Evhrk5HuLu4uKefiFMBaXqrXDWNJ3N4wHO4+0ti+QQkaUPC ylYw== X-Forwarded-Encrypted: i=1; AJvYcCWqsQ1tpr9O7q+pCSZSKqeuyeGfDwldALZge6dGFR9zmU+S2kFHKe2Mg/bVe4Pl+X7LjnSceIEbXJEajJqro1+SmrhhpXvlVAVyyL2J X-Gm-Message-State: AOJu0YwVR3a4s91jd1C/6/C2CTDbSL8Bkwltzp/cqYyYjSa9HQmcD6M0 Eie/fr/S489xma9jYXrrxexI8Sa3LqM14yWBirJcWugJtC2KMbcGdmUhd9CBeTPMGemFzKgPuIF PEgi4RUHhliopScyFaybxukS//keALGlCMHNZXsrUlveD2rM/1QUIHhtKTvi0KA== X-Received: by 2002:a17:903:246:b0:1eb:50eb:c07d with SMTP id d9443c01a7336-1ef441aa0a2mr161489395ad.4.1715722472117; Tue, 14 May 2024 14:34:32 -0700 (PDT) X-Received: by 2002:a17:903:246:b0:1eb:50eb:c07d with SMTP id d9443c01a7336-1ef441aa0a2mr161488855ad.4.1715722471349; Tue, 14 May 2024 14:34:31 -0700 (PDT) Received: from x1n ([50.204.89.32]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1ef0bad9da4sm102645805ad.107.2024.05.14.14.34.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 May 2024 14:34:30 -0700 (PDT) Date: Tue, 14 May 2024 15:34:24 -0600 From: Peter Xu To: Oscar Salvador Cc: Axel Rasmussen , Andrew Morton , Andy Lutomirski , "Aneesh Kumar K.V" , Borislav Petkov , Christophe Leroy , Dave Hansen , David Hildenbrand , "H. Peter Anvin" , Helge Deller , Ingo Molnar , "James E.J. Bottomley" , John Hubbard , Liu Shixin , "Matthew Wilcox (Oracle)" , Michael Ellerman , Muchun Song , "Naveen N. Rao" , Nicholas Piggin , Peter Zijlstra , Suren Baghdasaryan , Thomas Gleixner , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, x86@kernel.org Subject: Re: [PATCH v2 1/1] arch/fault: don't print logs for pte marker poison errors Message-ID: References: <20240510182926.763131-1-axelrasmussen@google.com> <20240510182926.763131-2-axelrasmussen@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: On Tue, May 14, 2024 at 10:26:49PM +0200, Oscar Salvador wrote: > On Fri, May 10, 2024 at 03:29:48PM -0400, Peter Xu wrote: > > IMHO we shouldn't mention that detail, but only state the effect which is > > to not report the event to syslog. > > > > There's no hard rule that a pte marker can't reflect a real page poison in > > the future even MCE. Actually I still remember most places don't care > > about the pfn in the hwpoison swap entry so maybe we can even do it? But > > that's another story regardless.. > > But we should not use pte markers for real hwpoisons events (aka MCE), right? The question is whether we can't. Now we reserved a swp entry just for hwpoison and it makes sense only because we cached the poisoned pfn inside. My long standing question is why do we ever need that pfn after all. If we don't need the pfn, we simply need a bit in the pgtable entry saying that it's poisoned, if accessed we should kill the process using sigbus. I used to comment on this before, the only path that uses that pfn is check_hwpoisoned_entry(), which was introduced in: commit a3f5d80ea401ac857f2910e28b15f35b2cf902f4 Author: Naoya Horiguchi Date: Mon Jun 28 19:43:14 2021 -0700 mm,hwpoison: send SIGBUS with error virutal address Now an action required MCE in already hwpoisoned address surely sends a SIGBUS to current process, but the SIGBUS doesn't convey error virtual address. That's not optimal for hwpoison-aware applications. To fix the issue, make memory_failure() call kill_accessing_process(), that does pagetable walk to find the error virtual address. It could find multiple virtual addresses for the same error page, and it seems hard to tell which virtual address is correct one. But that's rare and sending incorrect virtual address could be better than no address. So let's report the first found virtual address for now. So this time I read more on this and Naoya explained why - it's only used so far to dump the VA of the poisoned entry. However what confused me is, if an entry is poisoned already logically we dump that message in the fault handler not memory_failure(), which is: MCE: Killing uffd-unit-tests:650 due to hardware memory corruption fault at 7f3589d7e000 So perhaps we're trying to also dump that when the MCEs (points to the same pfn) are only generated concurrently? I donno much on hwpoison so I cannot tell, there's also implication where it's only triggered if MF_ACTION_REQUIRED. But I think it means hwpoison may work without pfn encoded, but I don't know the implication to lose that dmesg line. > I mean, we do have the means to mark a page as hwpoisoned when a real > MCE gets triggered, why would we want a pte marker to also reflect that? > Or is that something for userfaultd realm? No it's not userfaultfd realm.. it's just that pte marker should be a generic concept, so it logically can be used outside userfaultfd. That's also why it's used in swapin errors, in which case we don't use anything else in this case but a bit to reflect "this page is bad". > > > And also not report swapin error is, IMHO, only because arch errors said > > "MCE" in the error logs which may not apply here. Logically speaking > > swapin error should also be reported so admin knows better on why a proc is > > killed. Now it can still confuse the admin if it really happens, iiuc. > > I am bit confused by this. > It seems we create poisoned pte markers on swap errors (e.g: > unuse_pte()), which get passed down the chain with VM_FAULT_HWPOISON, > which end up in sigbus (I guess?). > > This all seems very subtle to me. > > First of all, why not passing VM_FAULT_SIGBUS if that is what will end > up happening? > I mean, at the moment that is not possible because we convolute swaping > errors and uffd poison in the same type of marker, so we do not have any > means to differentiate between the two of them. > > Would it make sense to create yet another pte marker type to split that > up? Because when I look at VM_FAULT_HWPOISON, I get reminded of MCE > stuff, and that does not hold here. We used to not dump error for swapin error. Note that here what I am saying is not that Axel is doing things wrong, but it's just that logically swapin error (as pte marker) can also be with !QUIET, so my final point is we may want to avoid having the assumption that "pte marker should always be QUITE", because I want to make it clear that pte marker can used in any form, so itself shouldn't imply anything.. Thanks, -- Peter Xu