Message ID | 1437478812-9650-1-git-send-email-sagig@mellanox.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
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@obsidianresearch.com> > Signed-off-by: Sagi Grimberg <sagig@mellanox.com> > drivers/infiniband/hw/mlx5/main.c | 3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) Reviewed-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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@obsidianresearch.com> > Signed-off-by: Sagi Grimberg <sagig@mellanox.com> > --- > 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.
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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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 >
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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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) /
Should be all the page sizes that are supported by the device. Reported-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com> Signed-off-by: Sagi Grimberg <sagig@mellanox.com> --- drivers/infiniband/hw/mlx5/main.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)