Re: [PATCH rdma-core 1/1] mlx5: Account for at least 1 medium bfreg in low_lat_uuars check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4/29/2018 8:34 PM, Rohit Zambre wrote:
On Sun, Apr 29, 2018 at 11:12 AM, Yishai Hadas
<yishaih@xxxxxxxxxxxxxxxxxx> wrote:

On 4/23/2018 8:58 PM, Rohit Zambre wrote:

The calculation of need_uuar_lock rightly accounts for at least 1 medium
bfreg.


The code should support even 0 medium bfregs comparing the suggested patch below.

So when the user sets MLX5_TOTAL_UUARS=16 and
MLX5_NUM_LOW_LAT_UUARS=15, the first 15 QPs will map to the 15 low
latency bfregs. To which bfreg will the 16th QP map to?

The 16th QP expects to get bfreg index 0 which is returned from the kernel once there are *no* low latency high class nor medium bfregs available. In this case DB is used in rdma-core instead of BF and no lock is needed. (see usage of bfs[bfi].buf_size)

However, looking in the kernel code, it seems that there is some bug in 'first_med_bfreg()' which had to handle this non-default case when there are no medium bfregs.

Below patch expects to fix that, can you please give it a try and confirm the fix ? this should come in parallel with the candidate patch that I have sent yesterday in rdma-core in need_uuar_lock().

--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -480,8 +480,12 @@ static int qp_has_rq(struct ib_qp_init_attr *attr)
        return 1;
 }

-static int first_med_bfreg(void)
+static int first_med_bfreg(struct mlx5_bfreg_info *bfregi)
 {
+       if (bfregi->total_num_bfregs -
+           (bfregi->num_low_latency_bfregs + bfregi->num_dyn_bfregs) == 1)
+               return -ENOMEM;
+
        return 1;
 }

@@ -537,10 +541,13 @@ static int alloc_high_class_bfreg(struct mlx5_ib_dev *dev,
 static int alloc_med_class_bfreg(struct mlx5_ib_dev *dev,
                                 struct mlx5_bfreg_info *bfregi)
 {
-       int minidx = first_med_bfreg();
+       int minidx = first_med_bfreg(bfregi);
        int i;

-       for (i = first_med_bfreg(); i < first_hi_bfreg(dev, bfregi); i++) {
+       if (minidx < 0)
+               return minidx;
+
+       for (i = minidx; i < first_hi_bfreg(dev, bfregi); i++) {
                if (bfregi->count[i] < bfregi->count[minidx])
                        minidx = i;

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



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux