Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp718006pxj; Thu, 3 Jun 2021 18:22:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwS11ZHst7TgYr+x+TmM+x6H0TIZj3pReaH7C7Bwv/ZWJil9rwJ968UYezxdvfSaNCHaL2C X-Received: by 2002:a05:6402:144d:: with SMTP id d13mr2066720edx.288.1622769722502; Thu, 03 Jun 2021 18:22:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622769722; cv=none; d=google.com; s=arc-20160816; b=hih3sKnGTtLB1zUJm6Xwvk1Rl9Iy02X0IomXNZ/tjk9h4zcVl6pb5uCR0E4SCmumk8 d55LYiMvPPxH27iN8cxXngcyqK03A+BdZ6avN9H3N/rIvRkQBtbblKUckQSko40+4V5c MfTcq/UWMXsOCvTJiqy2MUZrTCSnr5sqfyEkwSVc7A/WnCgXkipoTjzgQvAIKDQ/K62M +WedkHcc+SxpfS8l2JE/ub39hih/F7raWBab5IuuSCRCQ2SJipDa/iDOQC3KSdiSTd6S wXYa69Xz4a9uXqia5vRBopvaEOiPTNz1bC2KvrnXTRnmLqcUysupoVAb59Htv1BcEUZy W5dA== 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 :ironport-hdrordr; bh=lA58MZxV177KzSZ4r464wiJDItLwqWtwhewp3hw7IpE=; b=QEqcNXrhftD5LTpqkUKxhXGHB37+oBrMbnUJst+v0BQ+IEJmHPNa+QYNBWEARl52us cj2hreP0zx/z6NoK9ayClV9Ru93apRMA16KBDnakrYxCDz167QYN4QAsO0e3fOCnlT14 l7yJFAC7LYaPPtd06u/vTjta3QYYoLr8Sp4zBLnO+OKDhjZN/X1MjCuYEBoOt1M45msV BAa6XR/qtFKcWjU05jTAyPZf6tpkrbW8AWLHruRzMwHHUDisMeBj2gyacNjv1GYiP5o2 ta1cfIjE5RJm9FpOlWeUvRVpaB8i3AtDLzS4XArjtdpZhzYy31Ci0Nu43n+TYkHtVj3M QShA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m25si3538446edr.588.2021.06.03.18.21.38; Thu, 03 Jun 2021 18:22:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230050AbhFDBUx (ORCPT + 99 others); Thu, 3 Jun 2021 21:20:53 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:12817 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230037AbhFDBUx (ORCPT ); Thu, 3 Jun 2021 21:20:53 -0400 IronPort-HdrOrdr: =?us-ascii?q?A9a23=3AN4lpJ6sSDEGhtG3G4G6toNZs7skDktV00zEX?= =?us-ascii?q?/kB9WHVpmszxra6TdZMgpHnJYVcqKQgdcL+7WJVoLUmxyXcx2/h1AV7AZniAhI?= =?us-ascii?q?LLFvAA0WKK+VSJcEeSygce79YFT0EUMrzN5DZB4voSmDPIcerI3uP3jZyAtKPP?= =?us-ascii?q?yWt3VwF2Z+VF5wd9MAySFUp7X2B9dOEEPavZ9sxavCChZHhSSsy6A0MOV+/Fq8?= =?us-ascii?q?aOu4nhZXc9dmQawTjLnTW186T7DhTd+h8fVglEybAk/XOAsyGR3NTaj82G?= X-IronPort-AV: E=Sophos;i="5.83,246,1616428800"; d="scan'208";a="109209803" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 04 Jun 2021 09:19:06 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id 4A1734C369E0; Fri, 4 Jun 2021 09:19:01 +0800 (CST) Received: from G08CNEXJMPEKD02.g08.fujitsu.local (10.167.33.202) by G08CNEXMBPEKD04.g08.fujitsu.local (10.167.33.201) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 4 Jun 2021 09:18:51 +0800 Received: from G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.80) by G08CNEXJMPEKD02.g08.fujitsu.local (10.167.33.202) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 4 Jun 2021 09:18:50 +0800 Received: from irides.mr.mr.mr (10.167.225.141) by G08CNEXCHPEKD07.g08.fujitsu.local (10.167.33.209) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 4 Jun 2021 09:18:50 +0800 From: Shiyang Ruan To: , , , , , CC: , , , , , , Subject: [PATCH v4 01/10] pagemap: Introduce ->memory_failure() Date: Fri, 4 Jun 2021 09:18:35 +0800 Message-ID: <20210604011844.1756145-2-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210604011844.1756145-1-ruansy.fnst@fujitsu.com> References: <20210604011844.1756145-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-yoursite-MailScanner-ID: 4A1734C369E0.AF67F X-yoursite-MailScanner: Found to be clean X-yoursite-MailScanner-From: ruansy.fnst@fujitsu.com X-Spam-Status: No Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When memory-failure occurs, we call this function which is implemented by each kind of devices. For the fsdax case, pmem device driver implements it. Pmem device driver will find out the filesystem in which the corrupted page located in. And finally call filesystem handler to deal with this error. The filesystem will try to recover the corrupted data if possiable. Signed-off-by: Shiyang Ruan --- include/linux/memremap.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/linux/memremap.h b/include/linux/memremap.h index 45a79da89c5f..473fe18c516a 100644 --- a/include/linux/memremap.h +++ b/include/linux/memremap.h @@ -87,6 +87,14 @@ struct dev_pagemap_ops { * the page back to a CPU accessible page. */ vm_fault_t (*migrate_to_ram)(struct vm_fault *vmf); + + /* + * Handle the memory failure happens on one page. Notify the processes + * who are using this page, and try to recover the data on this page + * if necessary. + */ + int (*memory_failure)(struct dev_pagemap *pgmap, unsigned long pfn, + int flags); }; #define PGMAP_ALTMAP_VALID (1 << 0) -- 2.31.1