Skip to contentSkip to conversation

rdma/siw: fix NOMMU build

PATCH In review Arnd Bergmann 2 participants 3 messages Sep 6, 2019 – Sep 7, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rdma/siw: fix NOMMU build

On kernels without CONFIG_MMU, we get a link error for the siw driver:

drivers/infiniband/sw/siw/siw_mem.o: In function `siw_umem_get':
siw_mem.c:(.text+0x4c8): undefined reference to `can_do_mlock'

I don't know whether this driver is able to work at all without an MMU, but it's easy to avoid the link problem by adding another compile-time check.

Fixes 2251334dcac9 ("rdma/siw: application buffer management")
---
 drivers/infiniband/sw/siw/siw_mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/siw/siw_mem.c +1 -1
index e99983f07663..b3b614c07fdb 100644
@@ -374,7 +374,7 @@ struct siw_umem *siw_umem_get(u64 start, u64 len, bool writable)
 	unsigned int foll_flags = FOLL_WRITE;
 	int num_pages, num_chunks, i, rv = 0;
 
-	if (!can_do_mlock())
+	if (!IS_ENABLED(CONFIG_MMU) || !can_do_mlock())
 		return ERR_PTR(-EPERM);
 
 	if (!len)
Signature · 1 line
2.20.0
#1 lore raw
Quoted 19 lines · Arnd Bergmann

On kernels without CONFIG_MMU, we get a link error for the siw driver:

drivers/infiniband/sw/siw/siw_mem.o: In function `siw_umem_get':
siw_mem.c:(.text+0x4c8): undefined reference to `can_do_mlock'

I don't know whether this driver is able to work at all without an MMU, but it's easy to avoid the link problem by adding another compile-time check.

Fixes 2251334dcac9 ("rdma/siw: application buffer management")
 drivers/infiniband/sw/siw/siw_mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/sw/siw/siw_mem.c +1 -0
index e99983f07663..b3b614c07fdb 100644
+++ b/drivers/infiniband/sw/siw/siw_mem.c

drivers/infiniband/sw/siw/siw_mem.c struct siw_umem *siw_umem_get(u64 start, u64 len, bool writable) · line 378

Quoted 6 lines
drivers/infiniband/sw/siw/siw_mem.c +1 -1
@@ -374,7 +374,7 @@ struct siw_umem *siw_umem_get(u64 start, u64 len, bool writable)
 	unsigned int foll_flags = FOLL_WRITE;
 	int num_pages, num_chunks, i, rv = 0;
 
-	if (!can_do_mlock())
+	if (!IS_ENABLED(CONFIG_MMU) || !can_do_mlock())
 		return ERR_PTR(-EPERM);

I feel like !CONFIG_MMU should provide a dummy inline stub for can_do_mlock instead?

Jason

#2 lore raw
Quoted 10 lines · Jason Gunthorpe

drivers/infiniband/sw/siw/siw_mem.c struct siw_umem *siw_umem_get(u64 start, u64 len, bool writable) · line 378

Quoted 7 lines
drivers/infiniband/sw/siw/siw_mem.c +1 -1
@@ -374,7 +374,7 @@ struct siw_umem *siw_umem_get(u64 start, u64 len, bool writable)
      unsigned int foll_flags = FOLL_WRITE;
      int num_pages, num_chunks, i, rv = 0;
 
-     if (!can_do_mlock())
+     if (!IS_ENABLED(CONFIG_MMU) || !can_do_mlock())
              return ERR_PTR(-EPERM);

I feel like !CONFIG_MMU should provide a dummy inline stub for can_do_mlock instead?

Fair enough. I've added that to my test tree in place of my first patch and will send it after some more build testing.

Arnd