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 3B562C433EF for ; Tue, 1 Feb 2022 22:20:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AB8738D0092; Tue, 1 Feb 2022 17:20:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A66A88D006D; Tue, 1 Feb 2022 17:20:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 92E9C8D0092; Tue, 1 Feb 2022 17:20:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0195.hostedemail.com [216.40.44.195]) by kanga.kvack.org (Postfix) with ESMTP id 80C738D006D for ; Tue, 1 Feb 2022 17:20:52 -0500 (EST) Received: from smtpin16.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 38B961818FCF6 for ; Tue, 1 Feb 2022 22:20:52 +0000 (UTC) X-FDA: 79095631944.16.089690E Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by imf13.hostedemail.com (Postfix) with ESMTP id 9685920004 for ; Tue, 1 Feb 2022 22:20:51 +0000 (UTC) Received: by mail-pl1-f178.google.com with SMTP id u11so16544521plh.13 for ; Tue, 01 Feb 2022 14:20:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=cP1RItRPB7vUnAVbJjrqdJWUuTXRelnJhRLia4fkG6I=; b=ZYplhQdubQwHfZqDHkbj9MSIPwlGCYZA/bcuFjjSN53fikCSGA7rDKGuQSMY9u9ojc kqKcD72n6RFJ9ONWKB1LLXPw9ShvJbv4vuxspzWCZwrnHZsmAcIXYc/e90wszBDKcZYf BbzG8Ci4nTn++o2wgg7RxykKjrgPrGJ+qN2fK09yfhdiVPXmzgdI/aPtJeZeBCCi2KpY 0p6gytV5VRDI4rYnCKOb3USdLhxmEecRnCqqL7Uwsjrt6M10kxv5DeEcbWICVr/CGb4P E0sxLhoBnE1DuCRgHj4fyhIWlQ2VILJF7uJow+jfbg3MdfHdnxI4eVnxrfVJied6gRIx f5vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=cP1RItRPB7vUnAVbJjrqdJWUuTXRelnJhRLia4fkG6I=; b=ENFwONy0TPWMZIQFiW4JP3xUlhayRXEcXmOueRuwFrPyr5BaU1x1JfHKgnv7dSnP6X SI7tfEZf5WRI7MMS2XtIS0KS0vYn/25mH9TaiZbeMahevzE+ufEMAEzEKcjQ2QAfkzAD pjXSs/qbBTwxQUiJnW3IRRXUhSmlXFH+qiwhUrTq6dro6O3yaGx7u+nfcQbWCCB57jwk HZ7UDSsCV+kGIblpekPObrl+958NfYd4TFgZ5hZupV9aN9DRZIDa7v/qaeWZas4CEQ7r 8+l/rQ69OcP4monu+sCp83SgMQYucwMCeI2VZ7Vo2E8PQoLrjq6DbBXAWIhDNoY5hypt bH8g== X-Gm-Message-State: AOAM532u/JhQcpSjVTMlyOijLuhO5fUuOboEPNewWBFwUzi8aHSxgSFM RC4RexmrLT4zJMk5JXzloBdBnHCnceYL6DYVq8Nj7Q== X-Google-Smtp-Source: ABdhPJy1F/ijtoCZbpohM6YaRBqXV0qS1GwRp2bzd78B5NUMkUfKQR6sG8fbnNj6QrZugEHkDwhX0KdtzUZcoxSfoqQ= X-Received: by 2002:a17:902:d705:: with SMTP id w5mr27096337ply.34.1643754050454; Tue, 01 Feb 2022 14:20:50 -0800 (PST) MIME-Version: 1.0 References: <30a327fd-ae49-7412-ef77-9ec19480626e@oracle.com> <4786a41f-9048-e255-d48b-3922dd576255@oracle.com> <1a034e3d-3119-2947-843d-f9699af0d03a@oracle.com> In-Reply-To: <1a034e3d-3119-2947-843d-f9699af0d03a@oracle.com> From: Dan Williams Date: Tue, 1 Feb 2022 14:20:43 -0800 Message-ID: Subject: Re: [RFC] Missing compound_head() in memory-failure To: Joao Martins Cc: Jane Chu , Matthew Wilcox , Naoya Horiguchi , "linux-mm@kvack.org" , Andrew Morton Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 9685920004 X-Stat-Signature: efrpigu5bkn3qc467rc4qdkiyg84hszs Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=intel-com.20210112.gappssmtp.com header.s=20210112 header.b=ZYplhQdu; dmarc=fail reason="No valid SPF, DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=none (imf13.hostedemail.com: domain of dan.j.williams@intel.com has no SPF policy when checking 209.85.214.178) smtp.mailfrom=dan.j.williams@intel.com X-Rspam-User: nil X-HE-Tag: 1643754051-707235 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: On Tue, Feb 1, 2022 at 2:05 PM Joao Martins wrote: > > On 2/1/22 21:11, Jane Chu wrote: > > On 2/1/2022 7:46 AM, Matthew Wilcox wrote: > >> On Mon, Jan 31, 2022 at 08:54:39PM +0000, Joao Martins wrote: > >>> On 1/31/22 20:29, Matthew Wilcox wrote: > >>>> Unless I am mistaken, you have to pass the compound head of the page > >>>> which has the error to collect_procs(). Am I mistaken? > >>>> > >>> -rc2 already has a fix for it: > >>> > >>> https://lore.kernel.org/linux-mm/20220129021420.PgBIZm-q9%25akpm@linux-foundation.org/ > >>> > >>> Earlier in that function there's a: > >>> > >>> page = compound_head(page); > >>> > >>> So the @page passed to collect_procs() already is a head page. > >> > >> It's wrong though ;-( You set the HWPoison bit on the page after > >> calling compound_head(), so you set the bit on the head page instead > >> of the precise page that had the poison. > > > > Indeed. The rest of the kernel including pmem driver still deal with > > base page on clearing poison, bookkeeping etc. So the HWpoison bit needs > > to be set precisely on the poisoned base page such that we pass the > > correct 'pfn' to set_mce_nospec() to discourage speculative access. > > > set_mce_nospec() machinery makes no use of the HWPoison bit as far as > my reading goes. And the PFN that is passed to set_mce_nospec() is already > the subpage PFN that eventually lands on set_memory_np()/set_memory_uc() when > it changes the kernel page tables mapping (which also don't use the poison bit). > > I still can't see how device-dax machinery makes use of that bit? At least > the one which could use it (clear_mce_nospec()) doesn't actually go through > device-dax nvdimm-specific code only fsdax which I reiterate that the patch > does not change as there's no compound head there. Am I missing something? device-dax does not use that bit, because there is no kernel mediated access to the backing range. In the fsdax case that bit is used to determine when to run clear_mce_nospec(). Jane is in the process of reworking this path.