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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EF3DC25B75 for ; Wed, 15 May 2024 10:22:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C356B6B0352; Wed, 15 May 2024 06:22:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BE50E8D004F; Wed, 15 May 2024 06:22:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A5D9C6B035B; Wed, 15 May 2024 06:22:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 82AB26B0352 for ; Wed, 15 May 2024 06:22:06 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 097DF1203C5 for ; Wed, 15 May 2024 10:22:06 +0000 (UTC) X-FDA: 82120239852.06.E882DB5 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf12.hostedemail.com (Postfix) with ESMTP id CC47C40019 for ; Wed, 15 May 2024 10:22:03 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=osfCs+ZD; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=7YEKYFmQ; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=osfCs+ZD; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=7YEKYFmQ; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf12.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.131 as permitted sender) smtp.mailfrom=osalvador@suse.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1715768524; 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=bvnm5h9Dm1o+r/HqlbIr30i3nlCVPpxQO8iGYoJ/oZs=; b=kj4YzPaeMPqFtc64pPiNTj36Nkp9oOrDR/CDEhZQpb5VWKrNXmSwtXnPA/mgdXvW8IEwXO W3XDT9X5HFa3GEUnnSRKNMa3IxMeUMEr6iBAImExkMO9iJPkP7sIuiZEhUxtdJzCIXoQt3 nCwudn8BELJ/VTvRX5HLXrJ0ENCMkT0= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=osfCs+ZD; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=7YEKYFmQ; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=osfCs+ZD; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=7YEKYFmQ; dmarc=pass (policy=none) header.from=suse.de; spf=pass (imf12.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.131 as permitted sender) smtp.mailfrom=osalvador@suse.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1715768524; a=rsa-sha256; cv=none; b=vYntieSKeCKsFNWryLBj3f6Fi7m/thL0Lyt+7j3RnszPY8Z5beXIoN9IEqNSaexEhfTNzS Sqq5hMpMi/F8XJHWkTFUE254LpHxDIGyEZlXekNc164qavxHuzp7SG56pBuPWDfZKzaAwv uHP8/4PNrlvjiqMix+62tT4hdh63ppk= Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 479BE2050B; Wed, 15 May 2024 10:22:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715768522; h=from:from:reply-to: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=bvnm5h9Dm1o+r/HqlbIr30i3nlCVPpxQO8iGYoJ/oZs=; b=osfCs+ZDMySdssvcMGMbx0XH5WEA3dYR8XeMeO2WEbM+zOFp5pXTLthlcyjJwZTiDQaMaO VRvf+xfkEhs8CjC/OHJBKTpTgYm96uvH6V9ZSyzJlnHYJlsrwXrmqSJf5ZkE7vsJZRkoRN meER9rkMfyaCIwtzhdP0sqoekBwdiSc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715768522; h=from:from:reply-to: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=bvnm5h9Dm1o+r/HqlbIr30i3nlCVPpxQO8iGYoJ/oZs=; b=7YEKYFmQ+oTHb7De1VDCZo6Q0SgjUQQpJNuv7sC0p34RRxzmqFebeTGRNwRitQER1MDXDT JZD2wQKdQlPdaTBQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1715768522; h=from:from:reply-to: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=bvnm5h9Dm1o+r/HqlbIr30i3nlCVPpxQO8iGYoJ/oZs=; b=osfCs+ZDMySdssvcMGMbx0XH5WEA3dYR8XeMeO2WEbM+zOFp5pXTLthlcyjJwZTiDQaMaO VRvf+xfkEhs8CjC/OHJBKTpTgYm96uvH6V9ZSyzJlnHYJlsrwXrmqSJf5ZkE7vsJZRkoRN meER9rkMfyaCIwtzhdP0sqoekBwdiSc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1715768522; h=from:from:reply-to: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=bvnm5h9Dm1o+r/HqlbIr30i3nlCVPpxQO8iGYoJ/oZs=; b=7YEKYFmQ+oTHb7De1VDCZo6Q0SgjUQQpJNuv7sC0p34RRxzmqFebeTGRNwRitQER1MDXDT JZD2wQKdQlPdaTBQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id C9992139B3; Wed, 15 May 2024 10:22:00 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id C3aFLsiMRGZzXwAAD6G6ig (envelope-from ); Wed, 15 May 2024 10:22:00 +0000 Date: Wed, 15 May 2024 12:21:51 +0200 From: Oscar Salvador To: Peter Xu 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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspam-User: X-Rspamd-Server: rspam02 X-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0m1D0Mu6MF2C8gfhhBYRIaRKk/i9Z6TzcUetYdHDT8suIzyuNI1k6m7SOKGJ6QFPaN85Jm6CLexET5PqVczHHh/9ZoVdm/68mOH5iupOpGy4DGp2XMkdQZKYX6sMgOFIsiUyovkK3+4RBVdjFwnkxCtsSbRCpgeLhZiAfIi43g6El6Q+IEvbsbfIB8ZMlUlTZhEPoFtn7Djci3N56LSO8Q1nE8CL0ORo= 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: List-Subscribe: List-Unsubscribe: On Tue, May 14, 2024 at 03:34:24PM -0600, Peter Xu wrote: > 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. Well, not really dumped, but we just pass the VA down the chain to the signal handler. But on the question whether we need the pfn encoded, I am not sure actually. check_hwpoisoned_entry() checks whether the pfn where the pte sits is the same as the hwpoisoned one, so we know if the process has to be killed. Now, could we get away with using pte_page() instead of pte_pfn() in there, and passing the hwpoisoned page instead ot the pfn? I am trying to think of the implications, then we should not need the encoded pfn? > 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. Not necesarily concurrently, but simply if for any reason the page could not have been unmapped. Let us say you have ProcessA and ProcessB mapping the same page. We get an MCE for that page but we could not unmapped it, at least not from all processes (maybe just ProcessA). memory-failure code will mark it as hwpoison, now ProcessA faults it in and gets killed because we see that the page is hwpoisoned in the fault path, so we sill send VM_FAULT_HWPOISON all the way down till you see the: "MCE: Killing uffd-unit-tests:650 due to hardware memory corruption fault at 7f3589d7e000" from e.g: arch/x86/mm/fault.c:do_sigbus() Now, ProcessB still has the page mapped, so upon re-accessing it, it will trigger a new MCE event. memory-failure code will see that this page has already been marked as hwpoisoned, but since we failed to unmap it (otherwise no one should be re-accessing it), it goes: "ok, let's just kill everybody who has this page mapped". > 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.. I think it would make more sense if we have a separate marker for swapin errors? I mean, deep down, they do not mean the same as poison, right? Then you can choose which events get to be silent because you do not care, and which ones need to scream loud. I think swapin errors belong to the latter. At least I a heads-up why a process is getting killed is appreciated, IMHO. -- Oscar Salvador SUSE Labs