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 X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_50,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F2DCC433ED for ; Sat, 10 Apr 2021 04:48:00 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 87E3461008 for ; Sat, 10 Apr 2021 04:47:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 87E3461008 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5DD5E100EC1D3; Fri, 9 Apr 2021 21:47:59 -0700 (PDT) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.218.48; helo=mail-ej1-f48.google.com; envelope-from=dan.j.williams@intel.com; receiver= Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3021C100EF27B for ; Fri, 9 Apr 2021 21:47:55 -0700 (PDT) Received: by mail-ej1-f48.google.com with SMTP id r12so11765931ejr.5 for ; Fri, 09 Apr 2021 21:47:55 -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=IUlfB1PxZBzlfWVsuUB7DoL8DuKow3SV9dkNKtJvQl8=; b=PzQhs3H25xBuEYyUuPo1yLzVyCoU4N/t0VWEL8AOXuDQSs2wcAI9VZN8o2dgCSRUDe X4d2cIwPXZynRMrC+yajC5Pbc4DGfcF3gk/k4cW3ioDxu/YJaocpElpdw4OYTY2ZfDZg gSlXC2FKii/z7NsYL7TiXKIEac6Eg4wXWRkdWWf0grlxBEElUHiKKaBFJU2a1wjCbPSw sY/vf+WF4e7Rsu3iRK5EshDj5I60pMUAkIGZN+8lE+8av/dC3Nva4u5+28P0zVaI0cps CTs15kwMvwxv+x6cnQ3D3H/eI7nml7J/FwbGneMTipx6oUtGiA3/kH1Dt170mFCZL4Dp Jzxw== 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=IUlfB1PxZBzlfWVsuUB7DoL8DuKow3SV9dkNKtJvQl8=; b=U9jCYHhxzL9YHVy5GBPGUQ+gEFk7KDkSPza8W4D3usnXWocXitFwN/G83XDpia5Qj7 Gr0YMQGx/2uzj40BuEUv6bW0bbiYR8vijoRZkmrAHOPegFUw9Qm4tTw5zekBvCOLQvBp 6imVj7CU6Wnah6VpKUkWSTwUdr9cROq5JSLQ3bTnsTB93WtWYLpZaQ9oBPWhJff4PpP6 Xtrjxq5o8fotj3wukvTbi5pDSCP29LbG9REB/2h8LcfGeOQU+FTCt2N0jaX9te+KIxnT MTkJMfSCpMEOSzAZ6rYAB/3DET7LfdFoCSiGUccljfUcQnjGZVyxQIbZ6hdylRuARcbN U7mA== X-Gm-Message-State: AOAM531vsl6ZLSIpNxVoeaW1VirKEbni+Tmjqw9WIxDguN0wSLQzTqjY pkBADPsOKn1KJCLMpPzKXFCPqfrsLzmTGiKa9f8X6A== X-Google-Smtp-Source: ABdhPJw3BRny/nJ7YDCP9ZhZf9s/VYBIkbIoCCUxoMpLv6fa/HUI85KJ0IONcGK3hVwT7KMYKnW6xjZIQ3UXjJYi0BU= X-Received: by 2002:a17:906:ef2:: with SMTP id x18mr19292226eji.323.1618030013674; Fri, 09 Apr 2021 21:46:53 -0700 (PDT) MIME-Version: 1.0 References: <20210402092555.208590-1-vaibhav@linux.ibm.com> In-Reply-To: <20210402092555.208590-1-vaibhav@linux.ibm.com> From: Dan Williams Date: Fri, 9 Apr 2021 21:46:45 -0700 Message-ID: Subject: Re: [PATCH] libnvdimm/region: Update nvdimm_has_flush() to handle ND_REGION_ASYNC To: Vaibhav Jain Message-ID-Hash: 3KMBMRSFQ6MAOG55FTQST7E2LS6DN23B X-Message-ID-Hash: 3KMBMRSFQ6MAOG55FTQST7E2LS6DN23B X-MailFrom: dan.j.williams@intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: linux-nvdimm , Aneesh Kumar K , Michael Ellerman , Shivaprasad G Bhat X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Fri, Apr 2, 2021 at 2:26 AM Vaibhav Jain wrote: > > In case a platform doesn't provide explicit flush-hints but provides an > explicit flush callback via ND_REGION_ASYNC region flag, then > nvdimm_has_flush() still returns '0' indicating that writes do not > require flushing. This happens on PPC64 with patch at [1] applied, > where 'deep_flush' of a region was denied even though an explicit > flush function was provided. > > Fix this by adding a condition to nvdimm_has_flush() to test for the > ND_REGION_ASYNC flag on the region and see if a 'region->flush' > callback is assigned. Looks good. > > References: > [1] "powerpc/papr_scm: Implement support for H_SCM_FLUSH hcall" > https://lore.kernel.org/linux-nvdimm/161703936121.36.7260632399 582101498.stgit@e1fbed493c87 Looks like a typo happened in that link, I can fix that up. I'll also change this to the canonical "Link:" tag for references. > > Reported-by: Shivaprasad G Bhat > Signed-off-by: Vaibhav Jain > --- > drivers/nvdimm/region_devs.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c > index ef23119db574..e05cc9f8a9fd 100644 > --- a/drivers/nvdimm/region_devs.c > +++ b/drivers/nvdimm/region_devs.c > @@ -1239,6 +1239,11 @@ int nvdimm_has_flush(struct nd_region *nd_region) > || !IS_ENABLED(CONFIG_ARCH_HAS_PMEM_API)) > return -ENXIO; > > + /* Test if an explicit flush function is defined */ > + if (test_bit(ND_REGION_ASYNC, &nd_region->flags) && nd_region->flush) > + return 1; > + > + /* Test if any flush hints for the region are available */ > for (i = 0; i < nd_region->ndr_mappings; i++) { > struct nd_mapping *nd_mapping = &nd_region->mapping[i]; > struct nvdimm *nvdimm = nd_mapping->nvdimm; > @@ -1249,8 +1254,8 @@ int nvdimm_has_flush(struct nd_region *nd_region) > } > > /* > - * The platform defines dimm devices without hints, assume > - * platform persistence mechanism like ADR > + * The platform defines dimm devices without hints nor explicit flush, > + * assume platform persistence mechanism like ADR > */ > return 0; > } > -- > 2.30.2 > _______________________________________________ Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org To unsubscribe send an email to linux-nvdimm-leave@lists.01.org