diff mbox series

SUNRPC: Fix TCP receive code on archs with flush_dcache_page()

Message ID 20190103004211.12404-1-trond.myklebust@hammerspace.com (mailing list archive)
State New, archived
Headers show
Series SUNRPC: Fix TCP receive code on archs with flush_dcache_page() | expand

Commit Message

Trond Myklebust Jan. 3, 2019, 12:42 a.m. UTC
After receiving data into the page cache, we need to call flush_dcache_page()
for the architectures that define it.

Fixes: 277e4ab7d530b ("SUNRPC: Simplify TCP receive code by switching...")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Cc: stable@vger.kernel.org # v4.20
---
 net/sunrpc/xprtsock.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

Comments

kernel test robot Jan. 3, 2019, 5:29 a.m. UTC | #1
Hi Trond,

I love your patch! Yet something to improve:

[auto build test ERROR on nfs/linux-next]
[also build test ERROR on v4.20 next-20190102]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Trond-Myklebust/SUNRPC-Fix-TCP-receive-code-on-archs-with-flush_dcache_page/20190103-113507
base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=sh 

All errors (new ones prefixed by >>):

   net//sunrpc/xprtsock.c: In function 'xs_flush_bvec':
>> net//sunrpc/xprtsock.c:396:24: error: 'struct bio_vec' has no member named 'page'; did you mean 'bv_page'?
      flush_dcache_page(bv.page);
                           ^~~~
                           bv_page

vim +396 net//sunrpc/xprtsock.c

   383	
   384	#if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
   385	static void
   386	xs_flush_bvec(const struct bio_vec *bvec, size_t count, size_t seek)
   387	{
   388		struct bvec_iter bi, __start = {
   389			.bi_size = count,
   390		};
   391		struct bio_vec bv;
   392	
   393		bvec_iter_advance(bvec, &__start, seek & PAGE_MASK);
   394	
   395		for_each_bvec(bv, bvec, bi, __start)
 > 396			flush_dcache_page(bv.page);
   397	}
   398	#else
   399	static inline void
   400	xs_flush_bvec(const struct bio_vec *bvec, size_t count, size_t seek)
   401	{
   402	}
   403	#endif
   404	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Jan. 3, 2019, 6:45 a.m. UTC | #2
Hi Trond,

I love your patch! Perhaps something to improve:

[auto build test WARNING on nfs/linux-next]
[also build test WARNING on v4.20 next-20190102]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Trond-Myklebust/SUNRPC-Fix-TCP-receive-code-on-archs-with-flush_dcache_page/20190103-113507
base:   git://git.linux-nfs.org/projects/trondmy/linux-nfs.git linux-next
config: m68k-sun3_defconfig (attached as .config)
compiler: m68k-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=7.2.0 make.cross ARCH=m68k 

All warnings (new ones prefixed by >>):

   In file included from include/linux/pagemap.h:8:0,
                    from net/sunrpc/xprtsock.c:27:
   net/sunrpc/xprtsock.c: In function 'xs_flush_bvec':
   net/sunrpc/xprtsock.c:396:24: error: 'struct bio_vec' has no member named 'page'; did you mean 'bv_page'?
      flush_dcache_page(bv.page);
                           ^
   include/linux/mm.h:1258:48: note: in definition of macro 'page_address'
    #define page_address(page) lowmem_page_address(page)
                                                   ^~~~
>> net/sunrpc/xprtsock.c:396:3: note: in expansion of macro 'flush_dcache_page'
      flush_dcache_page(bv.page);
      ^~~~~~~~~~~~~~~~~

vim +/flush_dcache_page +396 net/sunrpc/xprtsock.c

   383	
   384	#if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
   385	static void
   386	xs_flush_bvec(const struct bio_vec *bvec, size_t count, size_t seek)
   387	{
   388		struct bvec_iter bi, __start = {
   389			.bi_size = count,
   390		};
   391		struct bio_vec bv;
   392	
   393		bvec_iter_advance(bvec, &__start, seek & PAGE_MASK);
   394	
   395		for_each_bvec(bv, bvec, bi, __start)
 > 396			flush_dcache_page(bv.page);
   397	}
   398	#else
   399	static inline void
   400	xs_flush_bvec(const struct bio_vec *bvec, size_t count, size_t seek)
   401	{
   402	}
   403	#endif
   404	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Sasha Levin Jan. 3, 2019, 1:52 p.m. UTC | #3
Hi,

[This is an automated email]

This commit has been processed because it contains a "Fixes:" tag,
fixing commit: 277e4ab7d530 SUNRPC: Simplify TCP receive code by switching to using iterators.

The bot has tested the following trees: v4.20.0, 

v4.20.0: Build failed! Errors:
    net/sunrpc/xprtsock.c:396:24: error: ‘struct bio_vec’ has no member named ‘page’; did you mean ‘bv_page’?


How should we proceed with this patch?

--
Thanks,
Sasha
Geert Uytterhoeven Jan. 3, 2019, 2 p.m. UTC | #4
Hi Sasha,

On Thu, Jan 3, 2019 at 2:52 PM Sasha Levin <sashal@kernel.org> wrote:
> [This is an automated email]
>
> This commit has been processed because it contains a "Fixes:" tag,
> fixing commit: 277e4ab7d530 SUNRPC: Simplify TCP receive code by switching to using iterators.
>
> The bot has tested the following trees: v4.20.0,
>
> v4.20.0: Build failed! Errors:
>     net/sunrpc/xprtsock.c:396:24: error: ‘struct bio_vec’ has no member named ‘page’; did you mean ‘bv_page’?
>
>
> How should we proceed with this patch?

Please drop it, as it was superseded by v2.

Gr{oetje,eeting}s,

                        Geert
Sasha Levin Jan. 5, 2019, 8:53 p.m. UTC | #5
On Thu, Jan 03, 2019 at 03:00:10PM +0100, Geert Uytterhoeven wrote:
>Hi Sasha,
>
>On Thu, Jan 3, 2019 at 2:52 PM Sasha Levin <sashal@kernel.org> wrote:
>> [This is an automated email]
>>
>> This commit has been processed because it contains a "Fixes:" tag,
>> fixing commit: 277e4ab7d530 SUNRPC: Simplify TCP receive code by switching to using iterators.
>>
>> The bot has tested the following trees: v4.20.0,
>>
>> v4.20.0: Build failed! Errors:
>>     net/sunrpc/xprtsock.c:396:24: error: ‘struct bio_vec’ has no member named ‘page’; did you mean ‘bv_page’?
>>
>>
>> How should we proceed with this patch?
>
>Please drop it, as it was superseded by v2.

Hi Geert,

These mails don't really mean that the patch got queued anywhere (as
it's obviously not upstream yet). It's more of a heads-up about how this
patch (won't) be backported to various -stable branches.

It's usually easier to get response from people while the patch is still
fresh in their heads rather than a few weeks later :)

--
Thanks,
Sasha
diff mbox series

Patch

diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index f0b3700cec95..ec239b02b86e 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -48,6 +48,7 @@ 
 #include <net/udp.h>
 #include <net/tcp.h>
 #include <linux/bvec.h>
+#include <linux/highmem.h>
 #include <linux/uio.h>
 
 #include <trace/events/sunrpc.h>
@@ -380,6 +381,27 @@  xs_read_discard(struct socket *sock, struct msghdr *msg, int flags,
 	return sock_recvmsg(sock, msg, flags);
 }
 
+#if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
+static void
+xs_flush_bvec(const struct bio_vec *bvec, size_t count, size_t seek)
+{
+	struct bvec_iter bi, __start = {
+		.bi_size = count,
+	};
+	struct bio_vec bv;
+
+	bvec_iter_advance(bvec, &__start, seek & PAGE_MASK);
+
+	for_each_bvec(bv, bvec, bi, __start)
+		flush_dcache_page(bv.page);
+}
+#else
+static inline void
+xs_flush_bvec(const struct bio_vec *bvec, size_t count, size_t seek)
+{
+}
+#endif
+
 static ssize_t
 xs_read_xdr_buf(struct socket *sock, struct msghdr *msg, int flags,
 		struct xdr_buf *buf, size_t count, size_t seek, size_t *read)
@@ -413,6 +435,7 @@  xs_read_xdr_buf(struct socket *sock, struct msghdr *msg, int flags,
 				seek + buf->page_base);
 		if (ret <= 0)
 			goto sock_err;
+		xs_flush_bvec(buf->bvec, ret, seek + buf->page_base);
 		offset += ret - buf->page_base;
 		if (offset == count || msg->msg_flags & (MSG_EOR|MSG_TRUNC))
 			goto out;