Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4169179pxj; Tue, 15 Jun 2021 17:20:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRfOINLgHb3dCfJG3PfRJEuK4r60OPPfLExng6dXc9qnnTKJxaIcjEcqkcg1EW5tqPzI0C X-Received: by 2002:a05:6638:10da:: with SMTP id q26mr1549945jad.125.1623802827208; Tue, 15 Jun 2021 17:20:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623802827; cv=none; d=google.com; s=arc-20160816; b=aZUA2LGOCE/4WM3xKto60FuCRa6vtOT3wkv6ug5dblhs/Ylxp6dKxjbrwtf3AiLQWQ 3JGDtAbhh3hbJv15K5/tRjtyqZ324J8nZ7yT89coEizowjLjD7OMgCu7dVhWnE6aJ311 twY+96NyrNiHXTh4RZdG6UaSe6dCNVF6lz2XQaseP1NnucpnkYqoB6FO2z6B0Lv6u4Cz tHQsMEecsRyZevyI8tyex9yFR4fwz6yLXPi3KoorD8basJcDmYIrY0sBUWGEfbRX9HEW Tk9MXcefhv5ukDb6jie56JoogJVpysj3IHEa7eP17xKqXZPS3xoaH/ER25KQeuCggwXx KK0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=U9ut0QO/e/N5V/O+/xxowpWen8UQyCbn6qtxkVe0D8Y=; b=J10EwtRwi+vKatVadh4KAXr5A96CK3QuCAm45BB4VO+BDi4sftkJ2eOVxvuJZi9j91 gFVMFAOmv5L8XYQ0mfsxUf5v5clG3JCE67vbNrYJ11fws+PqjUh/slKWfbtfRdfeYa3m pANZwfo7fqe32A3qKSo89kqOhyDl0H4i9V/ZzvsIQNVHco9aB8PUitTZn/p+IPPaTNCs d/SiU/azsvoJWNvBO9NsTzCnsgCOWk3g2rCZNveCZ6m8oHReFv3RnqvZWLGSZjnI+vAw LhP+Yi3eMdq2tghizbMbjB398ZL9svnxSlhqt82784R32CA3IMNf8WkG31qLNEheoJiI E+Dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=JcupgDdH; 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=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l16si678087jam.101.2021.06.15.17.20.14; Tue, 15 Jun 2021 17:20:27 -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; dkim=pass header.i=@intel-com.20150623.gappssmtp.com header.s=20150623 header.b=JcupgDdH; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231307AbhFPAUj (ORCPT + 99 others); Tue, 15 Jun 2021 20:20:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231354AbhFPAUe (ORCPT ); Tue, 15 Jun 2021 20:20:34 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D1BDC061760 for ; Tue, 15 Jun 2021 17:18:29 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id h12so209660plf.4 for ; Tue, 15 Jun 2021 17:18:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=U9ut0QO/e/N5V/O+/xxowpWen8UQyCbn6qtxkVe0D8Y=; b=JcupgDdHq+fmTtYahFp9g+jILqxB19u88v4xnoU55fWLv4k3YOt/xNPurkbzegMsAG NNMrQSJN/bCEgjMYNZUC20WGOBAV1diTK74G7f/VHGvqLwYEedYJtJ3nI0833KtrM7kU t9kGTrMECpFStf9TPmnQQJw6nw5sTkNZ2hgie5DWKEimBuk2Ql3jpZVgHKeZscFIfEWT FSm5OEwpwmmecOzudMjp4Rt+2O5WBV1LrdshwyVWQvhqJ4gbyL3GU3vgiXpk/OOtUG+R 9SDYxzyZHGzVP/HJP4qSzGSitzNNqYPJe6gGlgIMCb0EV5UH0BYz1vfNwhv1uIyZDqE+ Oifw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=U9ut0QO/e/N5V/O+/xxowpWen8UQyCbn6qtxkVe0D8Y=; b=b9OXhO69hkzSWUxCiNxhsWoDQDbueNDC4tnDXD8ocsy1XpWaWzrC7Ynl9Tz2Eqo7Ww pe1Kg0CFpolJ/+jMK7kmCP5NJsylqGyx2eq57Ib1/NK7JFrsn7VivPigfcgYMM7ibChz MBoJENgbV1pNF8k2vLG2UY94Vm6joul1uAkDK3tm+eZ/UjB5LNfzxSDMHuioksaYHgMT Bxyg1YmmvIXZy1yjL4KP6k36U8KzIqqHZKgkv6F7+5cCcABWSTGA5/QaehivZD+ZayfE mcTTOhlUNfj6YsMCncHlkZPVGx64N8mfGjHxoPrOJN+KmzlnFLS8Wyvn5CGwRT81uUTC a+GA== X-Gm-Message-State: AOAM531nq0ZnXOQJ10njC9M/0zN+0jrv9GVj/JXq9yjf4+y3CT8uo5xu Y//OkK3GLBAHgPbO+3zS1SR07pQUgkKzIl04l1OQoQ== X-Received: by 2002:a17:90a:ea8c:: with SMTP id h12mr7432919pjz.149.1623802708921; Tue, 15 Jun 2021 17:18:28 -0700 (PDT) MIME-Version: 1.0 References: <20210604011844.1756145-1-ruansy.fnst@fujitsu.com> <20210604011844.1756145-2-ruansy.fnst@fujitsu.com> In-Reply-To: <20210604011844.1756145-2-ruansy.fnst@fujitsu.com> From: Dan Williams Date: Tue, 15 Jun 2021 17:18:18 -0700 Message-ID: Subject: Re: [PATCH v4 01/10] pagemap: Introduce ->memory_failure() To: Shiyang Ruan Cc: Linux Kernel Mailing List , linux-xfs , linux-nvdimm , Linux MM , linux-fsdevel , device-mapper development , "Darrick J. Wong" , david , Christoph Hellwig , Alasdair Kergon , Mike Snitzer , Goldwyn Rodrigues Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 3, 2021 at 6:19 PM Shiyang Ruan wrote: Hi Ruan, apologies for the delays circling back to this. > > 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. > Let's move this change to the patch that needs it, this patch does not do anything on its own. > 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. > + */ I thought we discussed that this needed to be range based here: https://lore.kernel.org/r/CAPcyv4jhUU3NVD8HLZnJzir+SugB6LnnrgJZ-jP45BZrbJ1dJQ@mail.gmail.com ...but also incorporate Christoph's feedback to not use notifiers. > + int (*memory_failure)(struct dev_pagemap *pgmap, unsigned long pfn, > + int flags); Change this callback to int (*notify_memory_failure)(struct dev_pagemap *pgmap, unsigned long pfn, unsigned long nr_pfns) ...to pass a range and to clarify that this callback is for memory_failure() to notify the pgmap, the pgmap notifies the owner via the holder callbacks.