infiniband: Fix alignment of mmap cookies to support VIPT caching
authorJason Gunthorpe <jgunthorpe@obsidianresearch.com>
Fri, 10 Mar 2017 18:34:20 +0000 (11:34 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Dec 2017 13:23:41 +0000 (14:23 +0100)
commitf4fcc56632cfd6d204ca6d64ad0912e626016b65
tree342021a3dd9210cdb7e8ec2c76b588f73b4ea60f
parentcd083d5bcafdc17e6192ddaed96f6744746c984b
infiniband: Fix alignment of mmap cookies to support VIPT caching

[ Upstream commit cb8864559631754ac93d5734b165ccd0cad4728c ]

When vmalloc_user is used to create memory that is supposed to be mmap'd
to user space, it is necessary for the mmap cookie (eg the offset) to be
aligned to SHMLBA.

This creates a situation where all virtual mappings of the same physical
page share the same virtual cache index and guarantees VIPT coherence.
Otherwise the cache is non-coherent and the kernel will not see writes
by userspace when reading the shared page (or vice-versa).

Reported-by: Josh Beavers <josh.beavers@gmail.com>
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/infiniband/sw/rdmavt/mmap.c
drivers/infiniband/sw/rxe/rxe_mmap.c