mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] rdma/siw: fix NOMMU build
@ 2019-09-06 15:10 Arnd Bergmann
  2019-09-07  7:34 ` Jason Gunthorpe
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2019-09-06 15:10 UTC (permalink / raw)
  To: Bernard Metzler, Doug Ledford, Jason Gunthorpe
  Cc: Arnd Bergmann, Jason Gunthorpe, Stephen Rothwell, Andrew Morton,
	John Hubbard, linux-rdma, linux-kernel

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")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/infiniband/sw/siw/siw_mem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/sw/siw/siw_mem.c b/drivers/infiniband/sw/siw/siw_mem.c
index e99983f07663..b3b614c07fdb 100644
--- a/drivers/infiniband/sw/siw/siw_mem.c
+++ b/drivers/infiniband/sw/siw/siw_mem.c
@@ -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)
-- 
2.20.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rdma/siw: fix NOMMU build
  2019-09-06 15:10 [PATCH] rdma/siw: fix NOMMU build Arnd Bergmann
@ 2019-09-07  7:34 ` Jason Gunthorpe
  2019-09-07 12:57   ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Jason Gunthorpe @ 2019-09-07  7:34 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Bernard Metzler, Doug Ledford, Stephen Rothwell, Andrew Morton,
	John Hubbard, linux-rdma, linux-kernel

On Fri, Sep 06, 2019 at 05:10:10PM +0200, Arnd Bergmann wrote:
> 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")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>  drivers/infiniband/sw/siw/siw_mem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/sw/siw/siw_mem.c b/drivers/infiniband/sw/siw/siw_mem.c
> index e99983f07663..b3b614c07fdb 100644
> +++ b/drivers/infiniband/sw/siw/siw_mem.c
> @@ -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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] rdma/siw: fix NOMMU build
  2019-09-07  7:34 ` Jason Gunthorpe
@ 2019-09-07 12:57   ` Arnd Bergmann
  0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2019-09-07 12:57 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Bernard Metzler, Doug Ledford, Stephen Rothwell, Andrew Morton,
	John Hubbard, linux-rdma, linux-kernel

On Sat, Sep 7, 2019 at 9:34 AM Jason Gunthorpe <jgg@mellanox.com> wrote:
> > @@ -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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-09-07 12:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-06 15:10 [PATCH] rdma/siw: fix NOMMU build Arnd Bergmann
2019-09-07  7:34 ` Jason Gunthorpe
2019-09-07 12:57   ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®