Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp557709pxk; Wed, 16 Sep 2020 10:42:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOjGTDXIWxE6H+xLkwkBDcfwTciadBLPHfz8rGOU+X6NgCzI9l3BPuXU1GaK1rnxj0dnMK X-Received: by 2002:a17:906:c830:: with SMTP id dd16mr27273850ejb.196.1600278159945; Wed, 16 Sep 2020 10:42:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600278159; cv=none; d=google.com; s=arc-20160816; b=FTLHZh56kXhR1+o0Uy2D4Yd6l+N9dtiWoZMWo/s4v/Ys2eKDCjD0cbhTaTcv6bZ7Sp zmWDDfJ2LuDykXAQamhwIP8fCrVECEH1LTuDcZNOPXmkJ74FgbZGakKb/ddGRDPM5Ro3 V5kY5nNs0LJbksxML24m0O1sslTMSCiJUTdVWfew4AajcprPZEEW8Rnv242WuUDVLI+K dwdVZ3Z1Fr9Q68iZ1D+E9fXqQcedkaMY/Lfi/QC9sctGhMAy90AxNe04gRpZjaxszigG aHB77YZl4AiKDWYctfNI18S/h9IB/zBw+PGKflFyBexxu/SEGu2RAOy7JU+dS0vuLhd5 058A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=4m/h+yY/PVAaaASlrExFZfjTuXa07+sxs0XLIUnFi6k=; b=NM/hMzqUYDBg1SF1PzYzHUsCRCj739hHKrFeXFruuLsCJ5g+wlxsnpKNunAtQ3Wd9G RPe4jOGAHqqKk80A48ZoXbPh5GF4iAit/fOkvALYLo3RUO6X0+FzoelNnWLw0vYWaGp7 +KwNuR0+0nwrVDpmxZevCHdHRpLPL1fvK4FpYyrKDpZkXibURowM5ntwO4GIvlVqA23L TtFbB7kSZ+w3qy/2Y8nRY2LNUbFniDqdXurTYJPYbOuT5t4jKsADgXbV1BSnjd6yKN5L KL5sX2HVH9C1WcC3zT9tNuKVDlhJQx+irZlf+OVHaOZSobWj1YhIZTmsYkBIyrjyPgrC ELQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=P9c7nPHL; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ay11si12013258edb.517.2020.09.16.10.42.17; Wed, 16 Sep 2020 10:42:39 -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=@redhat.com header.s=mimecast20190719 header.b=P9c7nPHL; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727348AbgIPRlS (ORCPT + 99 others); Wed, 16 Sep 2020 13:41:18 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:35626 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726767AbgIPRkX (ORCPT ); Wed, 16 Sep 2020 13:40:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600278022; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=4m/h+yY/PVAaaASlrExFZfjTuXa07+sxs0XLIUnFi6k=; b=P9c7nPHL9otLH5BgLeKK7eGgBPbxF3dA6sHFKZRDWfZMHLNXrSKHvkCjPO8Nwqyxoa73aX 69jQWSanpxSyNWhBBMu1maSmMGVCr2GSOH1rUIgDHgWfcI+Qh3PZSwA+dZbuNT0ZpvAhtg rESQYrRKxaY0NsVCYOYLASK6MLQ/RrE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-485-JHbHg4c9NlaKwI5bE_0bzQ-1; Wed, 16 Sep 2020 06:57:15 -0400 X-MC-Unique: JHbHg4c9NlaKwI5bE_0bzQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2C02D1006712; Wed, 16 Sep 2020 10:57:13 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (file01.intranet.prod.int.rdu2.redhat.com [10.11.5.7]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9E3CC7880C; Wed, 16 Sep 2020 10:57:12 +0000 (UTC) Received: from file01.intranet.prod.int.rdu2.redhat.com (localhost [127.0.0.1]) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4) with ESMTP id 08GAvCZm014220; Wed, 16 Sep 2020 06:57:12 -0400 Received: from localhost (mpatocka@localhost) by file01.intranet.prod.int.rdu2.redhat.com (8.14.4/8.14.4/Submit) with ESMTP id 08GAvA4V014216; Wed, 16 Sep 2020 06:57:10 -0400 X-Authentication-Warning: file01.intranet.prod.int.rdu2.redhat.com: mpatocka owned process doing -bs Date: Wed, 16 Sep 2020 06:57:10 -0400 (EDT) From: Mikulas Patocka X-X-Sender: mpatocka@file01.intranet.prod.int.rdu2.redhat.com To: Dan Williams cc: Linus Torvalds , Alexander Viro , Andrew Morton , Vishal Verma , Dave Jiang , Ira Weiny , Matthew Wilcox , Jan Kara , Eric Sandeen , Dave Chinner , "Kani, Toshi" , "Norton, Scott J" , "Tadakamadla, Rajesh (DCIG/CDI/HPS Perf)" , Linux Kernel Mailing List , linux-fsdevel , linux-nvdimm Subject: [PATCH] pmem: export the symbols __copy_user_flushcache and __copy_from_user_flushcache In-Reply-To: Message-ID: References: User-Agent: Alpine 2.02 (LRH 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 15 Sep 2020, Mikulas Patocka wrote: > > > On Tue, 15 Sep 2020, Mikulas Patocka wrote: > > > > > - __copy_from_user_inatomic_nocache doesn't flush cache for leading and > > > > trailing bytes. > > > > > > You want copy_user_flushcache(). See how fs/dax.c arranges for > > > dax_copy_from_iter() to route to pmem_copy_from_iter(). > > > > Is it something new for the kernel 5.10? I see only __copy_user_flushcache > > that is implemented just for x86 and arm64. > > > > There is __copy_from_user_flushcache implemented for x86, arm64 and power. > > It is used in lib/iov_iter.c under > > #ifdef CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE - so should I use this? > > > > Mikulas > > ... and __copy_user_flushcache is not exported for modules. So, I am stuck > with __copy_from_user_inatomic_nocache. > > Mikulas I'm submitting this patch that adds the required exports (so that we could use __copy_from_user_flushcache on x86, arm64 and powerpc). Please, queue it for the next merge window. From: Mikulas Patocka Export the symbols __copy_user_flushcache and __copy_from_user_flushcache, so that modules can use this functionality. Signed-off-by: Mikulas Patocka --- arch/arm64/lib/uaccess_flushcache.c | 1 + arch/powerpc/lib/pmem.c | 1 + arch/x86/lib/usercopy_64.c | 1 + 3 files changed, 3 insertions(+) Index: linux-2.6/arch/arm64/lib/uaccess_flushcache.c =================================================================== --- linux-2.6.orig/arch/arm64/lib/uaccess_flushcache.c 2020-09-16 12:44:15.068038000 +0200 +++ linux-2.6/arch/arm64/lib/uaccess_flushcache.c 2020-09-16 12:44:15.068038000 +0200 @@ -38,3 +38,4 @@ unsigned long __copy_user_flushcache(voi __clean_dcache_area_pop(to, n - rc); return rc; } +EXPORT_SYMBOL_GPL(__copy_user_flushcache); Index: linux-2.6/arch/x86/lib/usercopy_64.c =================================================================== --- linux-2.6.orig/arch/x86/lib/usercopy_64.c 2020-09-16 12:44:15.068038000 +0200 +++ linux-2.6/arch/x86/lib/usercopy_64.c 2020-09-16 12:44:15.068038000 +0200 @@ -134,6 +134,7 @@ long __copy_user_flushcache(void *dst, c return rc; } +EXPORT_SYMBOL_GPL(__copy_user_flushcache); void __memcpy_flushcache(void *_dst, const void *_src, size_t size) { Index: linux-2.6/arch/powerpc/lib/pmem.c =================================================================== --- linux-2.6.orig/arch/powerpc/lib/pmem.c 2020-09-16 12:44:15.068038000 +0200 +++ linux-2.6/arch/powerpc/lib/pmem.c 2020-09-16 12:44:15.068038000 +0200 @@ -75,6 +75,7 @@ long __copy_from_user_flushcache(void *d return copied; } +EXPORT_SYMBOL_GPL(__copy_from_user_flushcache); void memcpy_flushcache(void *dest, const void *src, size_t size) {