Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp6815611pxv; Fri, 30 Jul 2021 03:07:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxO0loHUS6KCrf4lZhIxKwTrOFE7P+TRFYALllU/SkCytEbX5iXwGpoFlmQ/9LOL9X5vr/6 X-Received: by 2002:aa7:dada:: with SMTP id x26mr2050884eds.156.1627639668353; Fri, 30 Jul 2021 03:07:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627639668; cv=none; d=google.com; s=arc-20160816; b=euh2mQMGKCquMFATHDxQRcN+M3ElbrjDRHGEn4oBJsqs/WTQWDjP66IcKlL0FQ/j6P HdISiyBeoZY0YvDXZo96+YEj8UnD3Gf4kdNuVjDlBlEUEwiDy5XX3HZiIuye3pbHPOj6 XfOE8MUkNtBxmGZz7GS4hJ8JDWdyARRJ7wPiLTqMieaL2f/5ExKZXS7XQauqJPT7VAVV HSs3bcT4+0E/FljuXxPUPept4TXJa03u7sRc3Y2iLNuxKQSYl3T0dLCGyOHmgNdx+ac2 raLtNDZoh9vV8AwRTiekEnhY1c6IS++615sy6AglCoJWyoKTnX+XUsRMRWsuVDix6Pq7 AWyQ== 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=wLZYssbgdonpseJF93bqdxJbdbsVHEXV01FHsjRRIUQ=; b=PQ7Jc/Rp1RH3QSicNbYipi861g+kI3vGi+GyTLwprEEPkBV8VhFkPTfuuspcyGwk/w vkgXTXHlxsR7M6zO1BkExP/qSBwX9RtF/0blhPc3jccxlfeM365H00vSAZi7v3G2Ugmg da+waEsGOOOnpCPX+0dFcOoIR/c4jtFC/jo5ZQocrcz5eH9TC4R5SAEY5IUorKz+uEl4 twzOhh7YOepG9JvCVWDaHf0/jqmOGMt31kPku0CBsQcm08pH2rBkO3mXTEaH/wyJ/s9E rOwO1PNJUhd5OzcLNSrzokifVdkLkUe3+B8LicVymA6SIx7wd0dPekFcbEU0k/fes3or Y9mA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qa37si1291041ejc.383.2021.07.30.03.07.24; Fri, 30 Jul 2021 03:07:48 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238507AbhG3KEG (ORCPT + 99 others); Fri, 30 Jul 2021 06:04:06 -0400 Received: from mail.cn.fujitsu.com ([183.91.158.132]:36456 "EHLO heian.cn.fujitsu.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S238419AbhG3KD4 (ORCPT ); Fri, 30 Jul 2021 06:03:56 -0400 IronPort-HdrOrdr: =?us-ascii?q?A9a23=3ATLULHaxol51Ut6bUyMQBKrPwyr1zdoMgy1kn?= =?us-ascii?q?xilNoRw8SK2lfqeV7Y0mPH7P+U4ssR4b6LO90cW7Lk80sKQFhbX5Xo3SOjUO2l?= =?us-ascii?q?HYTr2KhLGKq1aLdkHDH6xmpMBdmsNFaOEYY2IVsS+D2njcLz8/+qj6zImYwffZ?= =?us-ascii?q?02x2TRxnL4Vp7wJCAA6dFUFsLTM2f6YRJd6N4NZdvTq8dTAyZsS/PHMMWO/OvJ?= =?us-ascii?q?nlj5TjCCR2eiIP2U2fiy+y8r7mH1y91hcaaTlGxrAv6izkvmXCl96ej80=3D?= X-IronPort-AV: E=Sophos;i="5.84,281,1620662400"; d="scan'208";a="112074009" Received: from unknown (HELO cn.fujitsu.com) ([10.167.33.5]) by heian.cn.fujitsu.com with ESMTP; 30 Jul 2021 18:02:12 +0800 Received: from G08CNEXMBPEKD04.g08.fujitsu.local (unknown [10.167.33.201]) by cn.fujitsu.com (Postfix) with ESMTP id 479004D0D49E; Fri, 30 Jul 2021 18:02:11 +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.23; Fri, 30 Jul 2021 18:02:06 +0800 Received: from G08CNEXCHPEKD09.g08.fujitsu.local (10.167.33.85) by G08CNEXJMPEKD02.g08.fujitsu.local (10.167.33.202) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Fri, 30 Jul 2021 18:02:03 +0800 Received: from irides.mr.mr.mr (10.167.225.141) by G08CNEXCHPEKD09.g08.fujitsu.local (10.167.33.209) with Microsoft SMTP Server id 15.0.1497.23 via Frontend Transport; Fri, 30 Jul 2021 18:02:01 +0800 From: Shiyang Ruan To: , , , , , CC: , , , , , Subject: [PATCH RESEND v6 1/9] pagemap: Introduce ->memory_failure() Date: Fri, 30 Jul 2021 18:01:50 +0800 Message-ID: <20210730100158.3117319-2-ruansy.fnst@fujitsu.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210730100158.3117319-1-ruansy.fnst@fujitsu.com> References: <20210730100158.3117319-1-ruansy.fnst@fujitsu.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-yoursite-MailScanner-ID: 479004D0D49E.A0288 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 necessary. Signed-off-by: Shiyang Ruan --- include/linux/memremap.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/memremap.h b/include/linux/memremap.h index c0e9d35889e8..ed6980087db5 100644 --- a/include/linux/memremap.h +++ b/include/linux/memremap.h @@ -87,6 +87,15 @@ 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 a range of pfns. Notify the + * processes who are using these pfns, and try to recover the data on + * them if necessary. The flag is finally passed to the recover + * function through the whole notify routine. + */ + int (*memory_failure)(struct dev_pagemap *pgmap, unsigned long pfn, + unsigned long nr_pfns, int flags); }; #define PGMAP_ALTMAP_VALID (1 << 0) -- 2.32.0