linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mlx5: Expose correct page_size_cap in device attributes
@ 2015-07-21 11:40 Sagi Grimberg
       [not found] ` <1437478812-9650-1-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Sagi Grimberg @ 2015-07-21 11:40 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Jason Gunthorpe, Eli Cohen

Should be all the page sizes that are supported by the
device.

Reported-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
Signed-off-by: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
 drivers/infiniband/hw/mlx5/main.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
index 725f857..a90ef7a 100644
--- a/drivers/infiniband/hw/mlx5/main.c
+++ b/drivers/infiniband/hw/mlx5/main.c
@@ -212,6 +212,7 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,
 	int err = -ENOMEM;
 	int max_rq_sg;
 	int max_sq_sg;
+	u64 min_page_size = 1ull << MLX5_CAP_GEN(mdev, log_pg_sz);
 
 	if (uhw->inlen || uhw->outlen)
 		return -EINVAL;
@@ -264,7 +265,7 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,
 	props->hw_ver		   = mdev->pdev->revision;
 
 	props->max_mr_size	   = ~0ull;
-	props->page_size_cap	   = 1ull << MLX5_CAP_GEN(mdev, log_pg_sz);
+	props->page_size_cap	   = ~(min_page_size - 1);
 	props->max_qp		   = 1 << MLX5_CAP_GEN(mdev, log_max_qp);
 	props->max_qp_wr	   = 1 << MLX5_CAP_GEN(mdev, log_max_qp_sz);
 	max_rq_sg =  MLX5_CAP_GEN(mdev, max_wqe_sz_rq) /
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] mlx5: Expose correct page_size_cap in device attributes
       [not found] ` <1437478812-9650-1-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
@ 2015-07-21 16:32   ` Jason Gunthorpe
  2015-07-23 21:41   ` Doug Ledford
  1 sibling, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2015-07-21 16:32 UTC (permalink / raw)
  To: Sagi Grimberg; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Eli Cohen

On Tue, Jul 21, 2015 at 02:40:12PM +0300, Sagi Grimberg wrote:
> Should be all the page sizes that are supported by the
> device.
> 
> Reported-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> Signed-off-by: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>  drivers/infiniband/hw/mlx5/main.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)

Reviewed-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

The math looks better now

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] mlx5: Expose correct page_size_cap in device attributes
       [not found] ` <1437478812-9650-1-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
  2015-07-21 16:32   ` Jason Gunthorpe
@ 2015-07-23 21:41   ` Doug Ledford
       [not found]     ` <55B15F92.6070604-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
  1 sibling, 1 reply; 6+ messages in thread
From: Doug Ledford @ 2015-07-23 21:41 UTC (permalink / raw)
  To: Sagi Grimberg, linux-rdma-u79uwXL29TY76Z2rM5mHXA
  Cc: Jason Gunthorpe, Eli Cohen

[-- Attachment #1: Type: text/plain, Size: 1659 bytes --]

On 07/21/2015 07:40 AM, Sagi Grimberg wrote:
> Should be all the page sizes that are supported by the
> device.
> 
> Reported-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
> Signed-off-by: Sagi Grimberg <sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
> ---
>  drivers/infiniband/hw/mlx5/main.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c
> index 725f857..a90ef7a 100644
> --- a/drivers/infiniband/hw/mlx5/main.c
> +++ b/drivers/infiniband/hw/mlx5/main.c
> @@ -212,6 +212,7 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,
>  	int err = -ENOMEM;
>  	int max_rq_sg;
>  	int max_sq_sg;
> +	u64 min_page_size = 1ull << MLX5_CAP_GEN(mdev, log_pg_sz);
>  
>  	if (uhw->inlen || uhw->outlen)
>  		return -EINVAL;
> @@ -264,7 +265,7 @@ static int mlx5_ib_query_device(struct ib_device *ibdev,
>  	props->hw_ver		   = mdev->pdev->revision;
>  
>  	props->max_mr_size	   = ~0ull;
> -	props->page_size_cap	   = 1ull << MLX5_CAP_GEN(mdev, log_pg_sz);
> +	props->page_size_cap	   = ~(min_page_size - 1);
>  	props->max_qp		   = 1 << MLX5_CAP_GEN(mdev, log_max_qp);
>  	props->max_qp_wr	   = 1 << MLX5_CAP_GEN(mdev, log_max_qp_sz);
>  	max_rq_sg =  MLX5_CAP_GEN(mdev, max_wqe_sz_rq) /
> 

I assume this prevents the driver from working at all on certain arches
(like ppc with 64k page size)?  It looks obviously correct enough that
I've picked it up for 4.2-rc.  Thanks.

-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
              GPG KeyID: 0E572FDD



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

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

* Re: [PATCH] mlx5: Expose correct page_size_cap in device attributes
       [not found]     ` <55B15F92.6070604-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2015-07-23 21:48       ` Jason Gunthorpe
       [not found]         ` <20150723214832.GA16756-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Jason Gunthorpe @ 2015-07-23 21:48 UTC (permalink / raw)
  To: Doug Ledford; +Cc: Sagi Grimberg, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Eli Cohen

On Thu, Jul 23, 2015 at 05:41:38PM -0400, Doug Ledford wrote:

> I assume this prevents the driver from working at all on certain arches
> (like ppc with 64k page size)?

Nothing uses page_size_cap correctly, so it has no impact.

Sagi, that is a good point, your generic code for the cleanup series
really should check that PAGE_SIZE is in page_size_cap and at least
fail the mr allocation if it isn't...

Maybe that would be enough to drop SRP's bogus usage of it...

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH] mlx5: Expose correct page_size_cap in device attributes
       [not found]         ` <20150723214832.GA16756-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2015-07-24 14:34           ` Doug Ledford
  2015-07-26 11:02           ` Sagi Grimberg
  1 sibling, 0 replies; 6+ messages in thread
From: Doug Ledford @ 2015-07-24 14:34 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Sagi Grimberg, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Eli Cohen

[-- Attachment #1: Type: text/plain, Size: 752 bytes --]

On 07/23/2015 05:48 PM, Jason Gunthorpe wrote:
> On Thu, Jul 23, 2015 at 05:41:38PM -0400, Doug Ledford wrote:
> 
>> I assume this prevents the driver from working at all on certain arches
>> (like ppc with 64k page size)?
> 
> Nothing uses page_size_cap correctly, so it has no impact.

OK, then I'm going to skip this for 4.2-rc and bump it on out to 4.3.

> Sagi, that is a good point, your generic code for the cleanup series
> really should check that PAGE_SIZE is in page_size_cap and at least
> fail the mr allocation if it isn't...
> 
> Maybe that would be enough to drop SRP's bogus usage of it...
> 
> Jason
> 


-- 
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
              GPG KeyID: 0E572FDD



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

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

* Re: [PATCH] mlx5: Expose correct page_size_cap in device attributes
       [not found]         ` <20150723214832.GA16756-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  2015-07-24 14:34           ` Doug Ledford
@ 2015-07-26 11:02           ` Sagi Grimberg
  1 sibling, 0 replies; 6+ messages in thread
From: Sagi Grimberg @ 2015-07-26 11:02 UTC (permalink / raw)
  To: Jason Gunthorpe, Doug Ledford
  Cc: Sagi Grimberg, linux-rdma-u79uwXL29TY76Z2rM5mHXA, Eli Cohen

On 7/24/2015 12:48 AM, Jason Gunthorpe wrote:
> On Thu, Jul 23, 2015 at 05:41:38PM -0400, Doug Ledford wrote:
>
>> I assume this prevents the driver from working at all on certain arches
>> (like ppc with 64k page size)?
>
> Nothing uses page_size_cap correctly, so it has no impact.
>
> Sagi, that is a good point, your generic code for the cleanup series
> really should check that PAGE_SIZE is in page_size_cap and at least
> fail the mr allocation if it isn't...

Yea, that's doable...
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2015-07-26 11:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-21 11:40 [PATCH] mlx5: Expose correct page_size_cap in device attributes Sagi Grimberg
     [not found] ` <1437478812-9650-1-git-send-email-sagig-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2015-07-21 16:32   ` Jason Gunthorpe
2015-07-23 21:41   ` Doug Ledford
     [not found]     ` <55B15F92.6070604-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-07-23 21:48       ` Jason Gunthorpe
     [not found]         ` <20150723214832.GA16756-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2015-07-24 14:34           ` Doug Ledford
2015-07-26 11:02           ` Sagi Grimberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).