From patchwork Fri Oct 21 20:01:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Luck, Tony" X-Patchwork-Id: 509 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4242:0:0:0:0:0 with SMTP id s2csp881539wrr; Fri, 21 Oct 2022 13:07:43 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5vnM47ho9Pkmhnmu/ilgO5cK93oAllKvMyJW0PAUp3I2RPYgxmueSUYufpSCJSNWMGV4MT X-Received: by 2002:a05:6402:51ca:b0:45d:539f:5cc with SMTP id r10-20020a05640251ca00b0045d539f05ccmr18990456edd.47.1666382863438; Fri, 21 Oct 2022 13:07:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666382863; cv=none; d=google.com; s=arc-20160816; b=D/17l1vTWc8DFmh+XRVGM2fzLYQgJFgblnfFdlpVpbTOyRS7GQ/lZEowU3Ha7DFXFi TsO0/rCDJ3gjGqufmvku1gwro7/TISpQJMFmJJYDib5H2OaGVhs23VcfztDURf+UZ6ZO FQcT6XiOYKYkhfBYJTdy6ATUUexJ8UJQo9ARkMfbSMTWxlIDsRwHN5kRDVSHOIciXHnm IF0k3CkyjQpXEPRlpPhhFTs5xU80bn3rDqjbGdfNzGxEJPuHSHYV1TX+7QrE3sSovovD WlTrdFD4F+zlKywjxujl5YifARO0fsBdoM42J7Wv1n+0MNQd8a3z6U8Iq5K101kR8IB3 Vslw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Bj92xyG8bxkl9HoO5ww6obuUh+93oN3aGBtfxOmvtD0=; b=nQYG25kExajbPM4AVOG6X5f8gHTirAMmZhprJWwdxLrO5fGhOj633a3cdN8Nq4OF+B qoe82StJx4oTcAfELHFgNHroxULcP/yACnllGf2W4GOms2b6zor7KEPk+6aQg3/AdcL0 MH3tZD9YKI0/LvHQ3b0UpZ+YMy6MXbjxBOOM69dW6ZhXJPbccBuqkep/cxTYOkb7XK/e Mf+BU8jol5oTPSjJG7rnxLzleiPIyJiedz5GlAvffYz2shuXFxSBH2sMe4UmhhLHVfN0 OPmV0U2qzOPbjXkIVuB+MmqDFHX2ZLN7yGOKvgVW2Lpdp2IRMHvl2aEoLjbIfuZiAZX6 vxbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=iJGAohOr; 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=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sh37-20020a1709076ea500b0078d9d69ae0dsi21705535ejc.877.2022.10.21.13.07.17; Fri, 21 Oct 2022 13:07:43 -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=@intel.com header.s=Intel header.b=iJGAohOr; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229918AbiJUUBc (ORCPT + 99 others); Fri, 21 Oct 2022 16:01:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47014 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229727AbiJUUBa (ORCPT ); Fri, 21 Oct 2022 16:01:30 -0400 Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A5FE25E886 for ; Fri, 21 Oct 2022 13:01:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1666382488; x=1697918488; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/l/AGxNBveIFVLifPG7mHqaofFSHPy5andRAcNZBXFI=; b=iJGAohOrEopopUldTmSoMCuPLHyM2Tr2nHChri786Oz0HL+d9NZ7OHF/ REdNNoWz6/itKDUCH4iWPUvvae5d+sZUSLM3bJBQIHMia1f5U9EBal+Vo ofbK7LNPtmJ9SlIV92rgHu+pgt+EeWVx919ezlabvjnYPbdFWsTVkRp80 Ef5MTetcLnPOQi6X/ZJvFGhVPBQy3YKSiSoER+3EmgIciJZPk4KRymhvj enWKmAQzd7M2Fn1DBHM2BVy0iEg7Em7IA5SE6zbFuczDDia3wg4Y7LDtx gc0PnoNh6n19inksrVWzmKkDG/QfWwz/BIyxSDj598Sgmb6fq2jtyTpdB A==; X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="290401087" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="290401087" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:01:27 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10507"; a="633069084" X-IronPort-AV: E=Sophos;i="5.95,203,1661842800"; d="scan'208";a="633069084" Received: from agluck-desk3.sc.intel.com ([172.25.222.78]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2022 13:01:27 -0700 From: Tony Luck To: Naoya Horiguchi , Andrew Morton Cc: Miaohe Lin , Matthew Wilcox , Shuai Xue , Dan Williams , Michael Ellerman , Nicholas Piggin , Christophe Leroy , linux-mm@kvack.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Tony Luck Subject: [PATCH v3 0/2] Copy-on-write poison recovery Date: Fri, 21 Oct 2022 13:01:18 -0700 Message-Id: <20221021200120.175753-1-tony.luck@intel.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221019170835.155381-1-tony.luck@intel.com> References: <20221019170835.155381-1-tony.luck@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_NONE,URIBL_BLOCKED autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747329077487085312?= X-GMAIL-MSGID: =?utf-8?q?1747329077487085312?= Part 1 deals with the process that triggered the copy on write fault with a store to a shared read-only page. That process is send a SIGBUS with the usual machine check decoration to specify the virtual address of the lost page, together with the scope. Part 2 sets up to asynchronously take the page with the uncorrected error offline to prevent additional machine check faults. H/t to Miaohe Lin and Shuai Xue for pointing me to the existing function to queue a call to memory_failure(). On x86 there is some duplicate reporting (because the error is also signalled by the memory controller as well as by the core that triggered the machine check). Console logs look like this: [ 1647.723403] mce: [Hardware Error]: Machine check events logged Machine check from kernel copy routine [ 1647.723414] MCE: Killing einj_mem_uc:3600 due to hardware memory corruption fault at 7f3309503400 x86 fault handler sends SIGBUS to child process [ 1647.735183] Memory failure: 0x905b92d: recovery action for dirty LRU page: Recovered Async call to memory_failure() from copy on write path [ 1647.748397] Memory failure: 0x905b92d: already hardware poisoned uc_decode_notifier() processes memory controller report [ 1647.761313] MCE: Killing einj_mem_uc:3599 due to hardware memory corruption fault at 7f3309503400 Parent process tries to read poisoned page. Page has been unmapped, so #PF handler sends SIGBUS Tony Luck (2): mm, hwpoison: Try to recover from copy-on write faults mm, hwpoison: When copy-on-write hits poison, take page offline include/linux/highmem.h | 24 ++++++++++++++++++++++++ include/linux/mm.h | 5 ++++- mm/memory.c | 32 ++++++++++++++++++++++---------- 3 files changed, 50 insertions(+), 11 deletions(-)