Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* Re: [PATCH] Avoid that check_shl_overflow() triggers a compiler warning when building with W=1
From: Leon Romanovsky @ 2019-03-07  7:24 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Jason Gunthorpe, Kees Cook, linux-kernel@vger.kernel.org,
	linux-rdma@vger.kernel.org, Rasmus Villemoes
In-Reply-To: <8a5bd9ae-ebfe-687c-2868-d0f2a610d1e0@acm.org>

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

On Wed, Mar 06, 2019 at 06:14:09PM -0800, Bart Van Assche wrote:
> On 3/6/19 5:24 PM, Jason Gunthorpe wrote:
> > On Wed, Mar 06, 2019 at 05:01:53PM -0800, Bart Van Assche wrote:
> > > This patch avoids that the following warning is reported when building
> > > the mlx5 driver with W=1:
> > >
> > > drivers/infiniband/hw/mlx5/qp.c: In function set_user_rq_size:
> > > ./include/linux/overflow.h:230:6: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
> > >     _s >= 0 && _s < 8 * sizeof(*d) ? _s : 0;  \
> > >        ^
> > > drivers/infiniband/hw/mlx5/qp.c:5820:6: note: in expansion of macro check_shl_overflow
> > >    if (check_shl_overflow(rwq->wqe_count, rwq->wqe_shift, &rwq->buf_size))
> > >        ^~~~~~~~~~~~~~~~~~
> > >
> > > Cc: Jason Gunthorpe <jgg@mellanox.com>
> > > Cc: Leon Romanovsky <leonro@mellanox.com>
> > > Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> > > Fixes: 0c66847793d1 ("overflow.h: Add arithmetic shift helper") # v4.19
> > > Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> > >   include/linux/overflow.h | 22 ++++++++++++++++++++--
> > >   1 file changed, 20 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/include/linux/overflow.h b/include/linux/overflow.h
> > > index 40b48e2133cb..8afe0c0ada6f 100644
> > > +++ b/include/linux/overflow.h
> > > @@ -202,6 +202,24 @@
> > >   #endif /* COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW */
> > > +/*
> > > + * Evaluate a >= 0 without triggering a compiler warning if the type of a
> > > + * is an unsigned type.
> > > + */
> > > +#define is_positive(a) ({					\
> > > +	typeof(a) _minus_one = -1LL;				\
> > > +	typeof((a) + 0U) _sign_mask = _minus_one > 0 ? 0 :	\
> >
> > This is probably just is_signed_type(a)
>
> Hi Jason,
>
> I don't think that gcc accepts something like is_signed_type(typeof(a)) so
> I'm not sure that the is_signed_type() macro is useful in this context.
>
> > > +				1ULL << (8 * sizeof(a) - 1);	\
> > > +								\
> > > +	((a) & _sign_mask) == 0;				\
> > This is the same sort of obfuscation that Leon was building, do you
> > think the & is better than his ==, >  version?
> >
> > Will gcc shortcircuit the warning if we write it as
> >
> > (is_signed_type(a) && a < 0)
> >
> > ?
>
> I have tested this patch. With this patch applied no warnings are reported
> while building the mlx5 driver and the tests in lib/test_overflow.c pass.

Bart,

My simple patch passes too :).

>
> Thanks,
>
> Bart.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

^ permalink raw reply

* Re: [PATCH] Avoid that check_shl_overflow() triggers a compiler warning when building with W=1
From: Rasmus Villemoes @ 2019-03-07  7:18 UTC (permalink / raw)
  To: Bart Van Assche, Jason Gunthorpe
  Cc: Kees Cook, linux-kernel@vger.kernel.org,
	linux-rdma@vger.kernel.org, Leon Romanovsky
In-Reply-To: <8a5bd9ae-ebfe-687c-2868-d0f2a610d1e0@acm.org>

On 07/03/2019 03.14, Bart Van Assche wrote:
> On 3/6/19 5:24 PM, Jason Gunthorpe wrote:
>>>
>>> diff --git a/include/linux/overflow.h b/include/linux/overflow.h
>>> index 40b48e2133cb..8afe0c0ada6f 100644
>>> +++ b/include/linux/overflow.h
>>> @@ -202,6 +202,24 @@
>>>     #endif /* COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW */
>>>   +/*
>>> + * Evaluate a >= 0 without triggering a compiler warning if the type
>>> of a
>>> + * is an unsigned type.
>>> + */
>>> +#define is_positive(a) ({                    \

is_non_negative, please! positive means > 0. And perhaps it's better to
move these utility macros closer to the top of the file, together with
the other type/range helpers.

>>> +    typeof(a) _minus_one = -1LL;                \
>>> +    typeof((a) + 0U) _sign_mask = _minus_one > 0 ? 0 :    \
>>>> This is probably just is_signed_type(a)
> 
> Hi Jason,
> 
> I don't think that gcc accepts something like is_signed_type(typeof(a))
> so I'm not sure that the is_signed_type() macro is useful in this context.

Of course it does, it is even already used exactly that way in overflow.h.

Nice hack, I can't come up with anything better ATM. So if you fix the
name and reuse is_signed_type instead of opencoding it you can add my ack.

>>> +                1ULL << (8 * sizeof(a) - 1);    \
>>> +                                \
>>> +    ((a) & _sign_mask) == 0;                \
>>  
>> This is the same sort of obfuscation that Leon was building, do you
>> think the & is better than his ==, >  version?
>>
>> Will gcc shortcircuit the warning if we write it as
>>
>> (is_signed_type(a) && a < 0)
>>
>> ?

Unlikely, the Wtype-limits warning trigger at a very early stage of
parsing, so it's the mere presence of the a < 0 subexpression that
tickles it. So no amount of hiding it behind short-circuiting logic or
if() statements will help. See also the comment above
__signed_mul_overflow, where even code in the the untaken branch of a
__builtin_choose_expr() can trigger Wtype-limit.

> I have tested this patch. With this patch applied no warnings are
> reported while building the mlx5 driver and the tests in
> lib/test_overflow.c pass.

In cases like this it's good to be more explicit, i.e. "I've tested this
patch with gcc 6.5.4 and...", and even better of course if one does it
with several compiler versions. Please include the above paragraph +
compiler version info in the commit log.

Rasmus

^ permalink raw reply

* Re: [PATCH] Avoid that check_shl_overflow() triggers a compiler warning when building with W=1
From: Bart Van Assche @ 2019-03-07  2:14 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Kees Cook, linux-kernel@vger.kernel.org,
	linux-rdma@vger.kernel.org, Leon Romanovsky, Rasmus Villemoes
In-Reply-To: <20190307012417.GU1758@mellanox.com>

On 3/6/19 5:24 PM, Jason Gunthorpe wrote:
> On Wed, Mar 06, 2019 at 05:01:53PM -0800, Bart Van Assche wrote:
>> This patch avoids that the following warning is reported when building
>> the mlx5 driver with W=1:
>>
>> drivers/infiniband/hw/mlx5/qp.c: In function set_user_rq_size:
>> ./include/linux/overflow.h:230:6: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
>>     _s >= 0 && _s < 8 * sizeof(*d) ? _s : 0;  \
>>        ^
>> drivers/infiniband/hw/mlx5/qp.c:5820:6: note: in expansion of macro check_shl_overflow
>>    if (check_shl_overflow(rwq->wqe_count, rwq->wqe_shift, &rwq->buf_size))
>>        ^~~~~~~~~~~~~~~~~~
>>
>> Cc: Jason Gunthorpe <jgg@mellanox.com>
>> Cc: Leon Romanovsky <leonro@mellanox.com>
>> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
>> Fixes: 0c66847793d1 ("overflow.h: Add arithmetic shift helper") # v4.19
>> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
>>   include/linux/overflow.h | 22 ++++++++++++++++++++--
>>   1 file changed, 20 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/linux/overflow.h b/include/linux/overflow.h
>> index 40b48e2133cb..8afe0c0ada6f 100644
>> +++ b/include/linux/overflow.h
>> @@ -202,6 +202,24 @@
>>   
>>   #endif /* COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW */
>>   
>> +/*
>> + * Evaluate a >= 0 without triggering a compiler warning if the type of a
>> + * is an unsigned type.
>> + */
>> +#define is_positive(a) ({					\
>> +	typeof(a) _minus_one = -1LL;				\
>> +	typeof((a) + 0U) _sign_mask = _minus_one > 0 ? 0 :	\
> 
> This is probably just is_signed_type(a)

Hi Jason,

I don't think that gcc accepts something like is_signed_type(typeof(a)) 
so I'm not sure that the is_signed_type() macro is useful in this context.

>> +				1ULL << (8 * sizeof(a) - 1);	\
>> +								\
>> +	((a) & _sign_mask) == 0;				\
>  
> This is the same sort of obfuscation that Leon was building, do you
> think the & is better than his ==, >  version?
> 
> Will gcc shortcircuit the warning if we write it as
> 
> (is_signed_type(a) && a < 0)
> 
> ?

I have tested this patch. With this patch applied no warnings are 
reported while building the mlx5 driver and the tests in 
lib/test_overflow.c pass.

Thanks,

Bart.

^ permalink raw reply

* [GIT PULL] Please pull RDMA subsystem changes
From: Jason Gunthorpe @ 2019-03-07  1:34 UTC (permalink / raw)
  To: Linus Torvalds, Doug Ledford
  Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org

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

Hi Linus,

These are the proposed RDMA patches for 5.1.

There is a small conflict with the net tree in
drivers/infiniband/hw/mlx4/Kconfig that is resolved by deleting both
lines. There may also be conflicts with Matt's xarray tree that
changes some of the xarray APIs. RDMA has gained some new users of
those APIs this cycle.

Looking at the patchworks I'm thinking we might have a second merge
window pull request with some bug fixes and other rcish things that
were sent a little too late for this.

The next merge window may also see up to three new RDMA drivers, which
is quite unusual.

Thanks,
Jason

The tag for-linus-merged with my merge resolution to your tree is also available to pull.

The following changes since commit 08e8676f1607925adf36e399f0faa8ce3b10bb86:

  IB/mlx5: Add support for 50Gbps per lane link modes (2019-02-14 12:14:42 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma.git tags/for-linus

for you to fetch changes up to fca22e7e595f1799cfbfdfa13e16d48ece0d136c:

  net/mlx5: ODP support for XRC transport is not enabled by default in FW (2019-03-06 15:53:09 -0400)

----------------------------------------------------------------
5.1 Merge Window Pull Request

This has been a slightly more active cycle than normal with ongoing core
changes and quite a lot of collected driver updates.

- Various driver fixes for bnxt_re, cxgb4, hns, mlx5, pvrdma, rxe

- A new data transfer mode for HFI1 giving higher performance

- Significant functional and bug fix update to the mlx5 On-Demand-Paging MR
  feature

- A chip hang reset recovery system for hns

- Change mm->pinned_vm to an atomic64

- Update bnxt_re to support a new 57500 chip

- A sane netlink 'rdma link add' method for creating rxe devices and fixing
  the various unregistration race conditions in rxe's unregister flow

- Allow lookup up objects by an ID over netlink

- Various reworking of the core to driver interface:
  * Drivers should not assume umem SGLs are in PAGE_SIZE chunks
  * ucontext is accessed via udata not other means
  * Start to make the core code responsible for object memory
    allocation
  * Drivers should convert struct device to struct ib_device
    via a helper
  * Drivers have more tools to avoid use after unregister problems

----------------------------------------------------------------
Adit Ranadive (1):
      RDMA/vmw_pvrdma: Support upto 64-bit PFNs

Bart Van Assche (5):
      IB/core: Declare local functions 'static'
      IB/mlx5: Declare local functions 'static'
      RDMA/srp: Increase max_segment_size
      IB/core: Remove ib_sg_dma_address() and ib_sg_dma_len()
      IB/mlx5: Do not use hw_access_flags for be and CPU data

Colin Ian King (2):
      RDMA/bnxt_re: fix or'ing of data into an uninitialized struct member
      RDMA: Fix allocation failure on pointer pd

Dan Carpenter (2):
      RDMA/bnxt_re: fix a size calculation
      RDMA/core: Fix a WARN() message

Daniel Jurgens (4):
      IB/core: Unregister notifier before freeing MAD security
      IB/core: Fix potential memory leak while creating MAD agents
      IB/core: Eliminate a hole in MAD agent struct
      IB/core: Don't register each MAD agent for LSM notifier

Danit Goldberg (1):
      IB/cma: Define option to set ack timeout and pack tos_set

Davidlohr Bueso (8):
      mm: make mm->pinned_vm an atomic64 counter
      drivers/mic/scif: do not use mmap_sem
      drivers/IB,qib: optimize mmap_sem usage
      drivers/IB,hfi1: do not se mmap_sem
      drivers/IB,usnic: reduce scope of mmap_sem
      drivers/IB,core: reduce scope of mmap_sem
      Documentation/infiniband: update from locked to pinned_vm
      drivers/IB,qib: Fix pinned/locked limit check in qib_get_user_pages()

Devesh Sharma (9):
      RDMA/bnxt_re: Add chip context to identify 57500 series
      RDMA/bnxt_re: Add 64bit doorbells for 57500 series
      RDMA/bnxt_re: Skip backing store allocation for 57500 series
      RDMA/bnxt_re: Enable GSI QP support for 57500 series
      RDMA/bnxt_re: Add extended psn structure for 57500 adapters
      RDMA/bnxt_re: Update kernel user abi to pass chip context
      RDMA/bnxt_en: Enable RDMA driver support for 57500 chip
      bnxt_re: fix the regression due to changes in alloc_pbl
      bnxt_re: Clean cq for kernel consumers only

Doug Ledford (6):
      Merge branch 'opfn' into hfi1-tid
      Merge branch 'tid-read' into hfi1-tid
      Merge branch 'tid-write' into hfi1-tid
      Merge branch 'hfi1-tid' into wip/dl-for-next
      Merge branch 'wip/dl-for-next' into for-next
      Merge branch 'for-next' of git://git.kernel.org/.../rdma/rdma into for-next

Erez Alfasi (1):
      IB/ipoib: Use __func__ instead of function's name

Gal Pressman (6):
      IB/usnic: Fix out of bounds index check in query pkey
      RDMA/ocrdma: Fix out of bounds index check in query pkey
      RDMA/qedr: Fix out of bounds index check in query pkey
      RDMA: Add indication for in kernel API support to IB device
      IB/usnic: Remove stub functions
      IB/mlx5: Simplify WQE count power of two check

Greg Kroah-Hartman (8):
      infiniband: cxgb4: no need to check return value of debugfs_create functions
      infiniband: hfi1: drop crazy DEBUGFS_SEQ_FILE_CREATE() macro
      infiniband: hfi1: no need to check return value of debugfs_create functions
      infiniband: qib: no need to check return value of debugfs_create functions
      infiniband: mlx5: no need to check return value of debugfs_create functions
      infiniband: ocrdma: no need to check return value of debugfs_create functions
      infiniband: usnic: no need to check return value of debugfs_create functions
      infiniband: ipoib: no need to check return value of debugfs_create functions

Gustavo A. R. Silva (6):
      IB/cm: Use struct_size() in kmalloc()
      IB/usnic: Use struct_size() in kmalloc()
      IB/core: Use struct_size() in kzalloc()
      IB/srp: Use struct_size() in kzalloc()
      RDMA/mlx5: Replace kzalloc with kcalloc
      IB/hfi1: Add missing break in switch statement

Håkon Bugge (1):
      IB/mlx4: Increase the timeout for CM cache

Ira Weiny (1):
      RDMA/qib: Use GUP longterm for PSM page pining

Israel Rukshin (1):
      IB/iser: Pass the correct number of entries for dma mapped SGL

Jason Gunthorpe (27):
      IB/{core,hw}: Have ib_umem_get extract the ib_ucontext from ib_udata
      RDMA/device: Use __ib_device_get_by_name() in ib_device_rename()
      RDMA/iw_cxgb4: Drop __GFP_NOFAIL
      Merge branch 'devx-async' into k.o/for-next
      Merge branch 'mlx5-next into rdma.git for-next
      Merge tag 'v5.0-rc5' into rdma.git for-next
      RDMA/device: Check that the rename is nop under the lock
      RDMA/device: Ensure that security memory is always freed
      RDMA/device: Call ib_cache_release_one() only from ib_device_release()
      RDMA/device: Get rid of reg_state
      RDMA/device: Use an ida instead of a free page in alloc_name
      RDMA/devices: Use xarray to store the clients
      RDMA/devices: Use xarray to store the client_data
      RDMA/devices: Re-organize device.c locking
      lib/scatterlist: Provide a DMA page iterator
      RDMA/uverbs: Fix an error flow in ib_uverbs_poll_cq
      RDMA: Add and use rdma_for_each_port
      RDMA/device: Consolidate ib_device per_port data into one place
      RDMA/cache: Move the cache per-port data into the main ib_port_data
      RDMA/device: Add ib_device_set_netdev() as an alternative to get_netdev
      RDMA/device: Add ib_device_get_by_netdev()
      RDMA/rxe: Use ib_device_get_by_netdev() instead of open coding
      RDMA/device: Provide APIs from the core code to help unregistration
      RDMA/rxe: Use driver_unregister and new unregistration API
      RDMA/rxe: Add ib_device_get_by_name() and use it in rxe
      RDMA/rxe: Close a race after ib_register_device
      Merge branch 'mlx5-next' into rdma.git for-next

John Hubbard (2):
      RDMA/umem: minor bug fix in error handling path
      RDMA/umem: Revert broken 'off by one' fix

Kaike Wan (46):
      IB/hfi1: Add OPFN helper functions for TID RDMA feature
      IB/hfi1: OPFN interface
      IB/hfi1, IB/rdmavt: Allow for extending of QP's s_ack_queue
      IB/hfi1: Integrate OPFN into RC transactions
      IB/hfi1: Add static trace for OPFN
      IB/hfi: Move RC functions into a header file
      IB/hfi1: TID RDMA flow allocation
      IB/hfi1: TID RDMA RcvArray programming and TID allocation
      IB/hfi1: Add the counter n_tidwait
      IB/hfi1: Add static trace for flow and TID management functions
      IB/hfi1: Add functions to build TID RDMA READ request
      IB/hfi1: Set PbcInsertHcrc for TID RDMA packets
      IB/hfi1: Add functions to receive TID RDMA READ request
      IB/hfi1: Add a function to build TID RDMA READ response
      IB/hfi1: Add functions to receive TID RDMA READ response
      IB/hfi1: Add TID RDMA handlers
      IB/hfi1: Add functions for restarting TID RDMA READ request
      IB/hfi1: Increment the retry timeout value for TID RDMA READ request
      IB/hfi1: Integrate TID RDMA READ protocol into RC protocol
      IB/hfi1: Add interlock between a TID RDMA request and other requests
      IB/hfi1: Enable TID RDMA READ protocol
      IB/hfi1: Add static trace for TID RDMA READ protocol
      IB/hfi1: Build TID RDMA WRITE request
      IB/hfi1: Allow for extra entries in QP's s_ack_queue
      IB/hfi1: Add an s_acked_ack_queue pointer
      IB/hfi1: Add functions to receive TID RDMA WRITE request
      IB/hfi1: Add a function to build TID RDMA WRITE response
      IB/hfi1: Add TID resource timer
      IB/hfi1: Add a function to receive TID RDMA WRITE response
      IB/hfi1: Add a function to build TID RDMA WRITE DATA packet
      IB/hfi1: Add a function to receive TID RDMA WRITE DATA packet
      IB/hfi1: Add a function to build TID RDMA ACK packet
      IB/hfi1: Add a function to receive TID RDMA ACK packet
      IB/hfi1: Add TID RDMA retry timer
      IB/hfi1: Add a function to build TID RDMA RESYNC packet
      IB/hfi1: Add a function to receive TID RDMA RESYNC packet
      IB/hfi1: Resend the TID RDMA WRITE DATA packets
      IB/hfi1: Add the TID second leg send packet builder
      IB/hfi1: Add the TID second leg ACK packet builder
      IB/hfi1: Add the dual leg code
      IB/hfi1: Add TID RDMA WRITE functionality into RDMA verbs
      IB/hfi1: Add interlock between TID RDMA WRITE and other requests
      IB/hfi1: Enable TID RDMA WRITE protocol
      IB/hfi1: Add static trace for TID RDMA WRITE protocol
      IB/hfi1: Prioritize the sending of ACK packets
      IB/hfi1: Fix a build warning for TID RDMA READ

Kamal Heib (5):
      IB/ipoib: Make ipoib_intercept_dev_id_attr() static
      IB/mlx5: Make mlx5_ib_stage_odp_cleanup() static
      IB/mlx5: Remove set but not used variable
      RDMA/rxe: Move rxe_init_av() to rxe_av.c
      RDMA/rxe: Improve loopback marking

Leon Romanovsky (35):
      RDMA: Clean structures from CONFIG_INFINIBAND_ON_DEMAND_PAGING
      RDMA/core: Don't depend device ODP capabilities on kconfig option
      RDMA/mlx5: Introduce and reuse helper to identify ODP MR
      RDMA/mlx5: Embed into the code flow the ODP config option
      RDMA/mlx5: Delete declaration of already removed function
      RDMA: Clear PD objects during their allocation
      RDMA: Clear CQ objects during their allocation
      RDMA: Clear CTX objects during their allocation
      RDMA: Provide safe ib_alloc_device() function
      RDMA/nldev: Dynamically generate restrack dumpit callbacks
      RDMA/nldev: Factor out the PID namespace check
      RDMA/nldev: Prepare CAP_NET_ADMIN checks for .doit callbacks
      RDMA/core: Simplify restrack interface
      RDMA/restrack: Refactor user/kernel restrack additions
      RDMA/core: Use the ops infrastructure to keep all callbacks in one place
      RDMA/cma: Remove CM_ID statistics provided by rdma-cm module
      RDMA/core: Share driver structure size with core
      RDMA: Handle PD allocations by IB/core
      RDMA/nes: Remove useless usecnt variable and redundant memset
      RDMA/cxgb4: Remove kref accounting for sync operation
      RDMA/restrack: Convert internal DB from hash to XArray
      RDMA/restrack: Translate from ID to restrack object
      RDMA/nldev: Add resource tracker doit callback
      RDMA/restrack: Reduce scope of synchronization lock while updating DB
      RDMA/restrack: Hide restrack DB from IB/core
      net/mlx5: Factor out HCA capabilities functions
      RDMA/restrack: Prepare restrack_root to addition of extra fields per-type
      RDMA/nldev: Share with user-space object IDs
      RDMA/nldev: Provide parent IDs for PD, MR and QP objects
      RDMA/nldev: Connect QP number to .doit callback
      RDMA/nldev: Don't expose number of not-visible entries
      RDMA/iwcm: Fix string truncation error
      RDMA/uverbs: Store PR pointer before it is overwritten
      RDMA: Handle ucontext allocations by IB/core
      RDMA/uverbs: Don't do double free of allocated PD

Lijun Ou (7):
      RDMA/hns: Fix the bug with updating rq head pointer when flush cqe
      RDMA/hns: Bugfix for the scene without receiver queue
      RDMA/hns: Add constraint on the setting of local ACK timeout
      RDMA/hns: Modify the pbl ba page size for hip08
      RDMA/hns: RDMA/hns: Assign rq head pointer when enable rq record db
      RDMA/hns: Configure capacity of hns device
      RDMA/hns: Modify qp&cq&pd specification according to UM

Maor Gottlieb (1):
      IB/mlx5: Don't override existing ip_protocol

Mark Bloch (1):
      RDMA/mlx5: Fix memory leak in case we fail to add an IB device

Masahiro Yamada (2):
      infiniband: remove unneeded header search paths
      infiniband: prefix header search paths with $(srctree)/

Max Gurtovoy (1):
      IB/iser: Fix dma_nents type definition

Michael J. Ruhl (4):
      IB/{hfi1,qib}: Cleanup open coded sge sizing
      IB/{hfi1, qib, rvt} Cleanup open coded sge usage
      IB/rdmavt: Fix concurrency panics in QP post_send and modify to error
      IB/hfi1: Close race condition on user context disable and close

Mike Marciniszyn (2):
      IB/rdmavt: Add wc_flags and wc_immdata to cq entry trace
      IB/rdmavt: Fix loopback send with invalidate ordering

Mitko Haralanov (1):
      IB/hfi1: OPFN support discovery

Moni Shoua (17):
      IB/mlx5: Ranges in implicit ODP MR inherit its write access
      IB/mlx5: Remove dead code
      IB/mlx5: Fix the locking of SRQ objects in ODP events
      IB/core: Allocate a bit for SRQ ODP support
      IB/uverbs: Expose XRC ODP device capabilities
      IB/mlx5: Remove useless check in ODP handler
      IB/mlx5: Clean mlx5_ib_mr_responder_pfault_handler() signature
      IB/mlx5: Add XRC initiator ODP support
      IB/mlx5: Let read user wqe also from SRQ buffer
      IB/mlx5: Add ODP SRQ support
      IB/mlx5: Advertise SRQ ODP support for supported transports
      IB/mlx5: Advertise XRC ODP support
      IB/mlx5: Protect against prefetch of invalid MR
      IB/mlx5: Validate correct PD before prefetch MR
      IB/core: Abort page fault handler silently during owning process exit
      IB/mlx5: Set correct write permissions for implicit ODP MR
      net/mlx5: ODP support for XRC transport is not enabled by default in FW

Myungho Jung (1):
      RDMA/cma: Rollback source IP address if failing to acquire device

Noa Osherovich (1):
      RDMA/core: Verify that memory window type is legal

Parav Pandit (9):
      RDMA: Rename port_callback to init_port
      RDMA: Introduce and use rdma_device_to_ibdev()
      IB/core: Simplify rdma cgroup registration
      IB/umad: Avoid additional device reference during open()/close()
      IB/umad: Do not check status of nonseekable_open()
      IB/mlx5: Consider vlan of lower netdev for macvlan GID entries
      RDMA/core: Use simpler device_del() instead of device_unregister()
      RDMA/core: Introduce and use ib_setup_port_attrs()
      RDMA/core: Move device addition deletion to device.c

Parvi Kaustubhi (2):
      IB/usnic: Fix locking when unregistering
      IB/usnic: Fix deadlock

Potnuri Bharat Teja (1):
      iw_cxgb4: Check for send WR also while posting write with completion WR

Raju Rangoju (4):
      RDMA/iw_cxgb4: Fix the unchecked ep dereference
      cxgb4: add tcb flags and tcb rpl struct
      iw_cxgb4: complete the cached SRQ buffers
      iw_cxgb4: fix srqidx leak during connection abort

Shamir Rabinovitch (4):
      IB/{core,uverbs}: Move ib_umem_xxx functions from ib_core to ib_uverbs
      IB/uverbs: Add ib_ucontext to uverbs_attr_bundle sent from ioctl and cmd flows
      IB/verbs: Add helper function rdma_udata_to_drv_context
      IB/{hw,sw}: Remove 'uobject->context' dependency in object creation APIs

Shaobo He (1):
      cxgb4: kfree mhp after the debug print

Shiraz, Saleem (12):
      RDMA/bnxt_re: Use for_each_sg_dma_page iterator on umem SGL
      RDMA/mthca: Use for_each_sg_dma_page iterator on umem SGL
      RDMA/i40iw: Use for_each_sg_dma_page iterator on umem SGL
      RDMA/hns: Use for_each_sg_dma_page iterator on umem SGL
      RDMA/cxgb4: Use for_each_sg_dma_page iterator on umem SGL
      RDMA/cxgb3: Use for_each_sg_dma_page iterator on umem SGL
      RDMA/vmw_pvrdma: Use for_each_sg_dma_page iterator on umem SGL
      RDMA/qedr: Use for_each_sg_dma_page iterator on umem SGL
      RDMA/ocrdma: Use for_each_sg_dma_page iterator on umem SGL
      RDMA/rxe: Use for_each_sg_page iterator on umem SGL
      RDMA/rdmavt: Adapt to handle non-uniform sizes on umem SGEs
      RDMA/nes: Use for_each_sg_dma_page iterator for umem SGL

Steve Wise (12):
      iw_cxgb*: kzalloc the iwcm verbs struct
      RDMA/IWPM: refactor the IWPM message attribute names
      RDMA/IWPM: Support no port mapping requirements
      RDMA/iwpm: move kdoc comments to functions
      RDMA/cma: listening device cm_ids should inherit tos
      RDMA/iwcm: add tos_set bool to iw_cm struct
      iw_cxgb4: use listening ep tos when accepting new connections
      iw_cxgb4: use tos when importing the endpoint
      iw_cxgb4: use tos when finding ipv6 routes
      RDMA/core: Add RDMA_NLDEV_CMD_NEWLINK/DELLINK support
      rdma_rxe: Use netlink messages to add/delete links
      lib/irq_poll: Support schedules in non-interrupt contexts

Wei Hu (Xavier) (3):
      RDMA/hns: Fix the Oops during rmmod or insmod ko when reset occurs
      RDMA/hns: Fix the chip hanging caused by sending mailbox&CMQ during reset
      RDMA/hns: Fix the chip hanging caused by sending doorbell during reset

Wei Yongjun (1):
      iw_cxgb4: Make function read_tcb() static

Xiaofei Tan (1):
      RDMA/hns: Add the process of AEQ overflow for hip08

Yangyang Li (4):
      RDMA/hns: Add SCC context allocation support for hip08
      RDMA/hns: Add SCC context clr support for hip08
      RDMA/hns: Add timer allocation support for hip08
      RDMA/hns: Bugfix for set hem of SCC

Yishai Hadas (8):
      IB/mlx5: DEVX handling for indirection MKEY
      IB/mlx5: Manage indirection mkey upon DEVX flow for ODP
      IB/mlx5: Add support for ODP for DEVX indirection mkey
      IB/mlx5: Introduce MLX5_IB_OBJECT_DEVX_ASYNC_CMD_FD
      IB/mlx5: Introduce async DEVX obj query API
      IB/mlx5: Implement the file ops of DEVX async command FD
      IB/mlx5: Implement DEVX hot unplug for async command FD
      IB/mlx5: Fix bad flow upon DEVX mkey creation

Yixian Liu (3):
      RDMA/hns: Fix the state of rereg mr
      RDMA/hns: Set allocated memory to zero for wrid
      RDMA/hns: Delete useful prints for aeq subtype event

YueHaibing (6):
      RDMA/qedr: remove set but not used variable 'ib_ctx'
      IB/hw: Remove unneeded semicolons
      RDMA/hns: Remove set but not used variable 'rst'
      RDMA/hns: Make some function static
      RDMA/iwpm: Remove set but not used variable 'msg_seq'
      RDMA/hns: Use GFP_ATOMIC in hns_roce_v2_modify_qp

Yuval Avnery (1):
      IB/core: Destroy QP if XRC QP fails

Yuval Shaia (1):
      RDMA/core: Cosmetic change - move member initialization to correct block

Zhu Yanjun (1):
      IB/rxe: Remove unnecessary rxe variable

chenglang (1):
      RDMA/hns: Limit minimum ROCE CQ depth to 64

 .clang-format                                     |    2 +
 Documentation/infiniband/user_verbs.txt           |    4 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c        |    8 +-
 drivers/infiniband/Kconfig                        |   15 +-
 drivers/infiniband/core/Makefile                  |    4 +-
 drivers/infiniband/core/cache.c                   |  118 +-
 drivers/infiniband/core/cgroup.c                  |    5 +-
 drivers/infiniband/core/cm.c                      |    3 +-
 drivers/infiniband/core/cma.c                     |  139 +-
 drivers/infiniband/core/cma_priv.h                |    4 +-
 drivers/infiniband/core/core_priv.h               |   35 +-
 drivers/infiniband/core/device.c                  | 1323 +++--
 drivers/infiniband/core/iwcm.c                    |   13 +-
 drivers/infiniband/core/iwpm_msg.c                |  232 +-
 drivers/infiniband/core/iwpm_util.c               |   86 +-
 drivers/infiniband/core/iwpm_util.h               |   12 +
 drivers/infiniband/core/mad.c                     |    4 +-
 drivers/infiniband/core/netlink.c                 |    4 +-
 drivers/infiniband/core/nldev.c                   |  492 +-
 drivers/infiniband/core/rdma_core.c               |   42 +-
 drivers/infiniband/core/restrack.c                |  210 +-
 drivers/infiniband/core/restrack.h                |   28 +
 drivers/infiniband/core/rw.c                      |   12 +-
 drivers/infiniband/core/sa_query.c                |    4 +-
 drivers/infiniband/core/security.c                |   96 +-
 drivers/infiniband/core/sysfs.c                   |   93 +-
 drivers/infiniband/core/ucma.c                    |    7 +
 drivers/infiniband/core/umem.c                    |   60 +-
 drivers/infiniband/core/umem_odp.c                |   21 +-
 drivers/infiniband/core/user_mad.c                |   52 +-
 drivers/infiniband/core/uverbs_cmd.c              |   69 +-
 drivers/infiniband/core/uverbs_ioctl.c            |    3 +
 drivers/infiniband/core/uverbs_main.c             |    2 +
 drivers/infiniband/core/uverbs_std_types.c        |    2 +-
 drivers/infiniband/core/uverbs_uapi.c             |   15 +-
 drivers/infiniband/core/verbs.c                   |   73 +-
 drivers/infiniband/hw/bnxt_re/Kconfig             |    1 +
 drivers/infiniband/hw/bnxt_re/Makefile            |    2 +-
 drivers/infiniband/hw/bnxt_re/bnxt_re.h           |    1 +
 drivers/infiniband/hw/bnxt_re/ib_verbs.c          |  268 +-
 drivers/infiniband/hw/bnxt_re/ib_verbs.h          |   16 +-
 drivers/infiniband/hw/bnxt_re/main.c              |  134 +-
 drivers/infiniband/hw/bnxt_re/qplib_fp.c          |  193 +-
 drivers/infiniband/hw/bnxt_re/qplib_fp.h          |   47 +-
 drivers/infiniband/hw/bnxt_re/qplib_rcfw.c        |   40 +-
 drivers/infiniband/hw/bnxt_re/qplib_rcfw.h        |   45 +-
 drivers/infiniband/hw/bnxt_re/qplib_res.c         |   22 +-
 drivers/infiniband/hw/bnxt_re/qplib_res.h         |   30 +-
 drivers/infiniband/hw/bnxt_re/qplib_sp.c          |    3 +-
 drivers/infiniband/hw/bnxt_re/roce_hsi.h          |  160 +-
 drivers/infiniband/hw/cxgb3/Makefile              |    2 +-
 drivers/infiniband/hw/cxgb3/iwch.c                |    2 +-
 drivers/infiniband/hw/cxgb3/iwch_provider.c       |   95 +-
 drivers/infiniband/hw/cxgb4/Makefile              |    4 +-
 drivers/infiniband/hw/cxgb4/cm.c                  |  199 +-
 drivers/infiniband/hw/cxgb4/device.c              |   10 +-
 drivers/infiniband/hw/cxgb4/iw_cxgb4.h            |   16 +-
 drivers/infiniband/hw/cxgb4/mem.c                 |   36 +-
 drivers/infiniband/hw/cxgb4/provider.c            |   85 +-
 drivers/infiniband/hw/cxgb4/qp.c                  |   33 +-
 drivers/infiniband/hw/cxgb4/t4.h                  |    1 +
 drivers/infiniband/hw/hfi1/Makefile               |    1 +
 drivers/infiniband/hw/hfi1/chip.c                 |   13 +
 drivers/infiniband/hw/hfi1/chip.h                 |    4 +-
 drivers/infiniband/hw/hfi1/common.h               |    4 +
 drivers/infiniband/hw/hfi1/debugfs.c              |   58 +-
 drivers/infiniband/hw/hfi1/debugfs.h              |   12 -
 drivers/infiniband/hw/hfi1/driver.c               |   58 +-
 drivers/infiniband/hw/hfi1/fault.c                |   53 +-
 drivers/infiniband/hw/hfi1/hfi.h                  |   24 +-
 drivers/infiniband/hw/hfi1/init.c                 |   35 +-
 drivers/infiniband/hw/hfi1/iowait.c               |   34 +-
 drivers/infiniband/hw/hfi1/iowait.h               |   99 +-
 drivers/infiniband/hw/hfi1/opfn.c                 |  323 ++
 drivers/infiniband/hw/hfi1/opfn.h                 |   85 +
 drivers/infiniband/hw/hfi1/pio.c                  |   18 +-
 drivers/infiniband/hw/hfi1/qp.c                   |   76 +-
 drivers/infiniband/hw/hfi1/qp.h                   |    7 +
 drivers/infiniband/hw/hfi1/rc.c                   | 1141 ++++-
 drivers/infiniband/hw/hfi1/rc.h                   |   51 +
 drivers/infiniband/hw/hfi1/ruc.c                  |   48 +-
 drivers/infiniband/hw/hfi1/sdma.c                 |   24 +-
 drivers/infiniband/hw/hfi1/sdma_txreq.h           |    1 +
 drivers/infiniband/hw/hfi1/sysfs.c                |   16 +-
 drivers/infiniband/hw/hfi1/tid_rdma.c             | 5418 +++++++++++++++++++++
 drivers/infiniband/hw/hfi1/tid_rdma.h             |  311 +-
 drivers/infiniband/hw/hfi1/trace.c                |  118 +
 drivers/infiniband/hw/hfi1/trace.h                |    1 +
 drivers/infiniband/hw/hfi1/trace_ibhdrs.h         |    8 +
 drivers/infiniband/hw/hfi1/trace_rc.h             |   48 +
 drivers/infiniband/hw/hfi1/trace_rx.h             |  107 +-
 drivers/infiniband/hw/hfi1/trace_tid.h            | 1610 ++++++
 drivers/infiniband/hw/hfi1/trace_tx.h             |   18 +-
 drivers/infiniband/hw/hfi1/uc.c                   |    3 +-
 drivers/infiniband/hw/hfi1/ud.c                   |   24 +-
 drivers/infiniband/hw/hfi1/user_exp_rcv.h         |    1 -
 drivers/infiniband/hw/hfi1/user_pages.c           |   12 +-
 drivers/infiniband/hw/hfi1/user_sdma.c            |    9 +-
 drivers/infiniband/hw/hfi1/verbs.c                |  210 +-
 drivers/infiniband/hw/hfi1/verbs.h                |  104 +-
 drivers/infiniband/hw/hfi1/verbs_txreq.h          |    1 +
 drivers/infiniband/hw/hfi1/vnic_sdma.c            |    6 +-
 drivers/infiniband/hw/hns/Kconfig                 |    1 -
 drivers/infiniband/hw/hns/Makefile                |    2 +-
 drivers/infiniband/hw/hns/hns_roce_cmd.c          |   32 +-
 drivers/infiniband/hw/hns/hns_roce_cmd.h          |   12 +
 drivers/infiniband/hw/hns/hns_roce_cq.c           |    9 +-
 drivers/infiniband/hw/hns/hns_roce_db.c           |    6 +-
 drivers/infiniband/hw/hns/hns_roce_device.h       |   63 +-
 drivers/infiniband/hw/hns/hns_roce_hem.c          |   68 +-
 drivers/infiniband/hw/hns/hns_roce_hem.h          |    3 +
 drivers/infiniband/hw/hns/hns_roce_hw_v1.c        |   36 +-
 drivers/infiniband/hw/hns/hns_roce_hw_v2.c        |  596 ++-
 drivers/infiniband/hw/hns/hns_roce_hw_v2.h        |   92 +-
 drivers/infiniband/hw/hns/hns_roce_main.c         |   88 +-
 drivers/infiniband/hw/hns/hns_roce_mr.c           |   95 +-
 drivers/infiniband/hw/hns/hns_roce_pd.c           |   25 +-
 drivers/infiniband/hw/hns/hns_roce_qp.c           |   92 +-
 drivers/infiniband/hw/hns/hns_roce_srq.c          |   16 +-
 drivers/infiniband/hw/i40iw/Makefile              |    2 +-
 drivers/infiniband/hw/i40iw/i40iw_utils.c         |    1 -
 drivers/infiniband/hw/i40iw/i40iw_verbs.c         |  137 +-
 drivers/infiniband/hw/mlx4/Kconfig                |    1 -
 drivers/infiniband/hw/mlx4/cm.c                   |    2 +-
 drivers/infiniband/hw/mlx4/cq.c                   |   19 +-
 drivers/infiniband/hw/mlx4/doorbell.c             |    6 +-
 drivers/infiniband/hw/mlx4/main.c                 |   77 +-
 drivers/infiniband/hw/mlx4/mlx4_ib.h              |    3 +-
 drivers/infiniband/hw/mlx4/mr.c                   |   13 +-
 drivers/infiniband/hw/mlx4/qp.c                   |   84 +-
 drivers/infiniband/hw/mlx4/srq.c                  |   12 +-
 drivers/infiniband/hw/mlx5/Kconfig                |    1 -
 drivers/infiniband/hw/mlx5/cong.c                 |   15 +-
 drivers/infiniband/hw/mlx5/cq.c                   |   15 +-
 drivers/infiniband/hw/mlx5/devx.c                 |  463 +-
 drivers/infiniband/hw/mlx5/doorbell.c             |    6 +-
 drivers/infiniband/hw/mlx5/ib_rep.c               |    6 +-
 drivers/infiniband/hw/mlx5/main.c                 |  249 +-
 drivers/infiniband/hw/mlx5/mem.c                  |    5 +-
 drivers/infiniband/hw/mlx5/mlx5_ib.h              |   41 +-
 drivers/infiniband/hw/mlx5/mr.c                   |  126 +-
 drivers/infiniband/hw/mlx5/odp.c                  |  316 +-
 drivers/infiniband/hw/mlx5/qp.c                   |  308 +-
 drivers/infiniband/hw/mlx5/srq.c                  |   11 +-
 drivers/infiniband/hw/mlx5/srq.h                  |    2 -
 drivers/infiniband/hw/mlx5/srq_cmd.c              |   16 +-
 drivers/infiniband/hw/mthca/mthca_main.c          |    2 +-
 drivers/infiniband/hw/mthca/mthca_provider.c      |  139 +-
 drivers/infiniband/hw/mthca/mthca_qp.c            |   13 +-
 drivers/infiniband/hw/mthca/mthca_srq.c           |   21 +-
 drivers/infiniband/hw/nes/Kconfig                 |    2 +-
 drivers/infiniband/hw/nes/nes_verbs.c             |  313 +-
 drivers/infiniband/hw/nes/nes_verbs.h             |    1 -
 drivers/infiniband/hw/ocrdma/Makefile             |    2 +-
 drivers/infiniband/hw/ocrdma/ocrdma_main.c        |   12 +-
 drivers/infiniband/hw/ocrdma/ocrdma_stats.c       |   67 +-
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.c       |  189 +-
 drivers/infiniband/hw/ocrdma/ocrdma_verbs.h       |   11 +-
 drivers/infiniband/hw/qedr/main.c                 |    9 +-
 drivers/infiniband/hw/qedr/qedr_iw_cm.c           |    2 +-
 drivers/infiniband/hw/qedr/verbs.c                |  192 +-
 drivers/infiniband/hw/qedr/verbs.h                |   10 +-
 drivers/infiniband/hw/qib/qib_debugfs.c           |   27 +-
 drivers/infiniband/hw/qib/qib_rc.c                |    7 +-
 drivers/infiniband/hw/qib/qib_sdma.c              |   26 +-
 drivers/infiniband/hw/qib/qib_sysfs.c             |   18 +-
 drivers/infiniband/hw/qib/qib_ud.c                |    6 +-
 drivers/infiniband/hw/qib/qib_user_pages.c        |   75 +-
 drivers/infiniband/hw/qib/qib_verbs.c             |   20 +-
 drivers/infiniband/hw/usnic/Makefile              |    2 +-
 drivers/infiniband/hw/usnic/usnic_debugfs.c       |   26 -
 drivers/infiniband/hw/usnic/usnic_ib_main.c       |   57 +-
 drivers/infiniband/hw/usnic/usnic_ib_sysfs.c      |   26 +-
 drivers/infiniband/hw/usnic/usnic_ib_verbs.c      |  114 +-
 drivers/infiniband/hw/usnic/usnic_ib_verbs.h      |   28 +-
 drivers/infiniband/hw/usnic/usnic_uiom.c          |   65 +-
 drivers/infiniband/hw/usnic/usnic_uiom.h          |    1 -
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_cq.c      |    2 +-
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_dev_api.h |   15 +-
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c    |   12 +-
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_misc.c    |   21 +-
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_mr.c      |    3 +-
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c      |    6 +-
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c     |    4 +-
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c   |   98 +-
 drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.h   |   12 +-
 drivers/infiniband/sw/rdmavt/mr.c                 |   21 +-
 drivers/infiniband/sw/rdmavt/pd.c                 |   29 +-
 drivers/infiniband/sw/rdmavt/pd.h                 |    7 +-
 drivers/infiniband/sw/rdmavt/qp.c                 |  104 +-
 drivers/infiniband/sw/rdmavt/rc.c                 |   13 +
 drivers/infiniband/sw/rdmavt/srq.c                |    5 +-
 drivers/infiniband/sw/rdmavt/trace_cq.h           |   10 +-
 drivers/infiniband/sw/rdmavt/vt.c                 |   34 +-
 drivers/infiniband/sw/rxe/rxe.c                   |   67 +-
 drivers/infiniband/sw/rxe/rxe.h                   |   16 +-
 drivers/infiniband/sw/rxe/rxe_av.c                |    7 +
 drivers/infiniband/sw/rxe/rxe_comp.c              |    6 +-
 drivers/infiniband/sw/rxe/rxe_loc.h               |    9 +-
 drivers/infiniband/sw/rxe/rxe_mr.c                |   15 +-
 drivers/infiniband/sw/rxe/rxe_net.c               |   97 +-
 drivers/infiniband/sw/rxe/rxe_net.h               |    2 +-
 drivers/infiniband/sw/rxe/rxe_param.h             |    3 +-
 drivers/infiniband/sw/rxe/rxe_pool.c              |   77 +-
 drivers/infiniband/sw/rxe/rxe_pool.h              |    4 +
 drivers/infiniband/sw/rxe/rxe_qp.c                |   15 +-
 drivers/infiniband/sw/rxe/rxe_recv.c              |   12 +-
 drivers/infiniband/sw/rxe/rxe_resp.c              |    3 +-
 drivers/infiniband/sw/rxe/rxe_sysfs.c             |   40 +-
 drivers/infiniband/sw/rxe/rxe_verbs.c             |  103 +-
 drivers/infiniband/sw/rxe/rxe_verbs.h             |    9 +-
 drivers/infiniband/ulp/ipoib/ipoib.h              |    4 +-
 drivers/infiniband/ulp/ipoib/ipoib_fs.c           |    7 +-
 drivers/infiniband/ulp/ipoib/ipoib_main.c         |   14 +-
 drivers/infiniband/ulp/iser/iscsi_iser.h          |    2 +-
 drivers/infiniband/ulp/iser/iser_memory.c         |   19 +-
 drivers/infiniband/ulp/isert/Makefile             |    1 -
 drivers/infiniband/ulp/srp/ib_srp.c               |   26 +-
 drivers/infiniband/ulp/srpt/Makefile              |    1 -
 drivers/media/pci/intel/ipu3/ipu3-cio2.c          |    4 +-
 drivers/misc/mic/scif/scif_rma.c                  |   38 +-
 drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c     |    3 -
 drivers/net/ethernet/chelsio/cxgb4/t4_msg.h       |    8 +
 drivers/net/ethernet/chelsio/cxgb4/t4_tcb.h       |   12 +
 drivers/net/ethernet/mellanox/mlx5/core/main.c    |   85 +-
 fs/proc/task_mmu.c                                |    2 +-
 include/linux/cgroup_rdma.h                       |    2 +-
 include/linux/mlx5/driver.h                       |    5 +-
 include/linux/mm_types.h                          |    2 +-
 include/linux/scatterlist.h                       |   49 +-
 include/rdma/ib_hdrs.h                            |   14 +-
 include/rdma/ib_mad.h                             |    5 +-
 include/rdma/ib_umem.h                            |    8 +-
 include/rdma/ib_umem_odp.h                        |   34 +-
 include/rdma/ib_verbs.h                           |  274 +-
 include/rdma/iw_cm.h                              |   16 +-
 include/rdma/iw_portmap.h                         |  144 +-
 include/rdma/rdma_cm.h                            |    1 +
 include/rdma/rdma_netlink.h                       |   11 +
 include/rdma/rdma_vt.h                            |   30 +-
 include/rdma/rdmavt_qp.h                          |   20 +-
 include/rdma/restrack.h                           |   58 +-
 include/rdma/tid_rdma_defs.h                      |  108 +
 include/rdma/uverbs_ioctl.h                       |   18 +
 include/rdma/uverbs_std_types.h                   |   18 +-
 include/rdma/uverbs_types.h                       |    1 +
 include/uapi/rdma/bnxt_re-abi.h                   |   11 +
 include/uapi/rdma/ib_user_verbs.h                 |    2 +
 include/uapi/rdma/mlx5_user_ioctl_cmds.h          |   18 +
 include/uapi/rdma/mlx5_user_ioctl_verbs.h         |    5 +
 include/uapi/rdma/rdma_netlink.h                  |   74 +-
 include/uapi/rdma/rdma_user_cm.h                  |    4 +
 include/uapi/rdma/rdma_user_rxe.h                 |    3 +-
 kernel/cgroup/rdma.c                              |    5 +-
 kernel/events/core.c                              |    8 +-
 kernel/fork.c                                     |    2 +-
 lib/irq_poll.c                                    |    2 +-
 lib/scatterlist.c                                 |   26 +
 mm/debug.c                                        |    5 +-
 net/rds/ib.h                                      |   12 +-
 net/rds/ib_fmr.c                                  |    8 +-
 net/rds/ib_frmr.c                                 |    4 +-
 net/rds/ib_recv.c                                 |    8 +-
 net/rds/ib_send.c                                 |   15 +-
 264 files changed, 16710 insertions(+), 5014 deletions(-)
(diffstat from tag for-linus-merged)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* Re: [PATCH] Avoid that check_shl_overflow() triggers a compiler warning when building with W=1
From: Jason Gunthorpe @ 2019-03-07  1:24 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Kees Cook, linux-kernel@vger.kernel.org,
	linux-rdma@vger.kernel.org, Leon Romanovsky, Rasmus Villemoes
In-Reply-To: <20190307010153.81157-1-bvanassche@acm.org>

On Wed, Mar 06, 2019 at 05:01:53PM -0800, Bart Van Assche wrote:
> This patch avoids that the following warning is reported when building
> the mlx5 driver with W=1:
> 
> drivers/infiniband/hw/mlx5/qp.c: In function set_user_rq_size:
> ./include/linux/overflow.h:230:6: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
>    _s >= 0 && _s < 8 * sizeof(*d) ? _s : 0;  \
>       ^
> drivers/infiniband/hw/mlx5/qp.c:5820:6: note: in expansion of macro check_shl_overflow
>   if (check_shl_overflow(rwq->wqe_count, rwq->wqe_shift, &rwq->buf_size))
>       ^~~~~~~~~~~~~~~~~~
> 
> Cc: Jason Gunthorpe <jgg@mellanox.com>
> Cc: Leon Romanovsky <leonro@mellanox.com>
> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> Fixes: 0c66847793d1 ("overflow.h: Add arithmetic shift helper") # v4.19
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
>  include/linux/overflow.h | 22 ++++++++++++++++++++--
>  1 file changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/overflow.h b/include/linux/overflow.h
> index 40b48e2133cb..8afe0c0ada6f 100644
> +++ b/include/linux/overflow.h
> @@ -202,6 +202,24 @@
>  
>  #endif /* COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW */
>  
> +/*
> + * Evaluate a >= 0 without triggering a compiler warning if the type of a
> + * is an unsigned type.
> + */
> +#define is_positive(a) ({					\
> +	typeof(a) _minus_one = -1LL;				\
> +	typeof((a) + 0U) _sign_mask = _minus_one > 0 ? 0 :	\

This is probably just is_signed_type(a)

> +				1ULL << (8 * sizeof(a) - 1);	\
> +								\
> +	((a) & _sign_mask) == 0;				\


This is the same sort of obfuscation that Leon was building, do you
think the & is better than his ==, >  version?

Will gcc shortcircuit the warning if we write it as

(is_signed_type(a) && a < 0)

?

Jason

^ permalink raw reply

* [PATCH] Avoid that check_shl_overflow() triggers a compiler warning when building with W=1
From: Bart Van Assche @ 2019-03-07  1:01 UTC (permalink / raw)
  To: Kees Cook
  Cc: linux-kernel, linux-rdma, Bart Van Assche, Jason Gunthorpe,
	Leon Romanovsky, Rasmus Villemoes

This patch avoids that the following warning is reported when building
the mlx5 driver with W=1:

drivers/infiniband/hw/mlx5/qp.c: In function set_user_rq_size:
./include/linux/overflow.h:230:6: warning: comparison of unsigned expression >= 0 is always true [-Wtype-limits]
   _s >= 0 && _s < 8 * sizeof(*d) ? _s : 0;  \
      ^
drivers/infiniband/hw/mlx5/qp.c:5820:6: note: in expansion of macro check_shl_overflow
  if (check_shl_overflow(rwq->wqe_count, rwq->wqe_shift, &rwq->buf_size))
      ^~~~~~~~~~~~~~~~~~

Cc: Jason Gunthorpe <jgg@mellanox.com>
Cc: Leon Romanovsky <leonro@mellanox.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Fixes: 0c66847793d1 ("overflow.h: Add arithmetic shift helper") # v4.19
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 include/linux/overflow.h | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/include/linux/overflow.h b/include/linux/overflow.h
index 40b48e2133cb..8afe0c0ada6f 100644
--- a/include/linux/overflow.h
+++ b/include/linux/overflow.h
@@ -202,6 +202,24 @@
 
 #endif /* COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW */
 
+/*
+ * Evaluate a >= 0 without triggering a compiler warning if the type of a
+ * is an unsigned type.
+ */
+#define is_positive(a) ({					\
+	typeof(a) _minus_one = -1LL;				\
+	typeof((a) + 0U) _sign_mask = _minus_one > 0 ? 0 :	\
+				1ULL << (8 * sizeof(a) - 1);	\
+								\
+	((a) & _sign_mask) == 0;				\
+})
+
+/*
+ * Evaluate a < 0 without triggering a compiler warning if the type of a
+ * is an unsigned type.
+ */
+#define is_negative(a) !is_positive(a)
+
 /** check_shl_overflow() - Calculate a left-shifted value and check overflow
  *
  * @a: Value to be shifted
@@ -227,9 +245,9 @@
 	typeof(d) _d = d;						\
 	u64 _a_full = _a;						\
 	unsigned int _to_shift =					\
-		_s >= 0 && _s < 8 * sizeof(*d) ? _s : 0;		\
+		is_positive(_s) && _s < 8 * sizeof(*d) ? _s : 0;	\
 	*_d = (_a_full << _to_shift);					\
-	(_to_shift != _s || *_d < 0 || _a < 0 ||			\
+	(_to_shift != _s || is_negative(*_d) || is_negative(_a) ||	\
 		(*_d >> _to_shift) != _a);				\
 })
 
-- 
2.21.0

^ permalink raw reply related

* [PATCH v2] drivers: infiniband: Kconfig: pedantic formatting
From: Enrico Weigelt, metux IT consult @ 2019-03-06 22:08 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-rdma
In-Reply-To: <1551898167-18310-1-git-send-email-info@metux.net>

Formatting of Kconfig files doesn't look so pretty, so just
take damp cloth and clean it up.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
 drivers/infiniband/hw/bnxt_re/Kconfig | 10 +++++-----
 drivers/infiniband/ulp/iser/Kconfig   |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/infiniband/hw/bnxt_re/Kconfig b/drivers/infiniband/hw/bnxt_re/Kconfig
index 19982a4..05aa9fa 100644
--- a/drivers/infiniband/hw/bnxt_re/Kconfig
+++ b/drivers/infiniband/hw/bnxt_re/Kconfig
@@ -1,9 +1,9 @@
 config INFINIBAND_BNXT_RE
-    tristate "Broadcom Netxtreme HCA support"
-    depends on ETHERNET && NETDEVICES && PCI && INET && DCB
-    select NET_VENDOR_BROADCOM
-    select BNXT
-    ---help---
+	tristate "Broadcom Netxtreme HCA support"
+	depends on ETHERNET && NETDEVICES && PCI && INET && DCB
+	select NET_VENDOR_BROADCOM
+	select BNXT
+	---help---
 	  This driver supports Broadcom NetXtreme-E 10/25/40/50 gigabit
 	  RoCE HCAs.  To compile this driver as a module, choose M here:
 	  the module will be called bnxt_re.
diff --git a/drivers/infiniband/ulp/iser/Kconfig b/drivers/infiniband/ulp/iser/Kconfig
index d00af71..299268f 100644
--- a/drivers/infiniband/ulp/iser/Kconfig
+++ b/drivers/infiniband/ulp/iser/Kconfig
@@ -4,8 +4,8 @@ config INFINIBAND_ISER
 	select SCSI_ISCSI_ATTRS
 	---help---
 	  Support for the iSCSI Extensions for RDMA (iSER) Protocol
-          over InfiniBand. This allows you to access storage devices
-          that speak iSCSI over iSER over InfiniBand.
+	  over InfiniBand. This allows you to access storage devices
+	  that speak iSCSI over iSER over InfiniBand.
 
 	  The iSER protocol is defined by IETF.
 	  See <http://www.ietf.org/rfc/rfc5046.txt>
-- 
1.9.1

^ permalink raw reply related

* Re: [PATCH v1 iproute2-next 1/4] rdma: add helper rd_sendrecv_msg()
From: Steve Wise @ 2019-03-06 21:50 UTC (permalink / raw)
  To: 'Leon Romanovsky'; +Cc: dsahern, stephen, netdev, linux-rdma
In-Reply-To: <007901d4d294$62d5d280$28817780$@opengridcomputing.com>


On 3/4/2019 8:13 AM, Steve Wise wrote:
> Hey Leon, adding this to rd_recv_msg():
>
> @@ -693,10 +693,28 @@ int rd_recv_msg(struct rd *rd, mnl_cb_t callback, void
> *data, unsigned int seq)
>                 ret = mnl_cb_run(buf, ret, seq, portid, callback, data);
>         } while (ret > 0);
>
> +       if (ret < 0)
> +               perror(NULL);
> +
>         mnl_socket_close(rd->nl);
>         return ret;
>  }
>
> Results in unexpected errors being logged when doing a query such as:
>
> [root@stevo1 iproute2]# ./rdma/rdma res show qp lqpn 176
> error: Invalid argument
> link mlx5_0/1 lqpn 176 type UD state RTS sq-psn 0 comm [ib_core]
> error: Invalid argument
> error: No such file or directory
> error: Invalid argument
> error: No such file or directory
>
> It appears the "invalid argument" errors are due to rdmatool sending a
> RDMA_NLDEV_CMD_RES_QP_GET command using the doit kernel method to allow
> querying for just a QP with lqpn = 176.  However, rdmatool isn't passing a
> port index in the messages that generate the "invalid argument" error from
> the kernel.  IE you must provide a device index and port index when issuing
> a doit command vs a dumpit command.  I think. 
>
> This error was not found because rd_recv_msg() never displayed any errors
> previously.  Further, the RES_FUNC() massive macro has code that will retry
> a failed doit call with a dumpit call.  I think _##name() should distinguish
> between failures reported by the kernel doit function vs failures because no
> doit function exists.  Not sure how to support that.
>
>
>         static inline int _##name(struct rd *rd)
> \
>         {
> \
>                 uint32_t idx;
> \
>                 int ret;
> \
>                 if (id) {
> \
>                         ret = rd_doit_index(rd, &idx);
> \
>                         if (ret) {
> \
>                                 ret = _res_send_idx_msg(rd, command,
> \
>                                                         name##_idx_parse_cb,
> \
>                                                         idx, id);
> \
>                                 if (!ret)
> \
>                                         return ret;
> \
>                                 /* Fallback for old systems without .doit
> callbacks */ \
>                         }
> \
>                 }
> \
>                 return _res_send_msg(rd, command, name##_parse_cb);
> \
>         }
> \
>
>
>
> The "no such file or dir" errors are being returned because, in my setup,
> there are 2 other links that do not have lqpn 176.   So there are 2 issues
> uncovered by adding generic printing of errors in rd_recv_msg()
>
> 1) the doit code in rdmatool is generating requests for a doit method in the
> kernel w/o providing a port index.
> 2) some paths in rdmatool should not print "benign" errors like filtering on
> a GET command causing a "does not exist" error returned by the kernel doit
> func.
>
> #1 is a bug, IMO.  Can you propose a fix?
> #2 could be solved by adding an error callback func passed to rd_recv_msg().
> Then the RES_FUNC() functions could parse errors like "no such file or dir"
> when doing a filtered query and silently drop them.  And functions like
> dev_set_name() would display all errors returned because there are no
> expected errors other than "success".
>
> Steve.
>

Hey Leon, you've been quiet. :)   Thoughts?

Thanks,

Steve.

^ permalink raw reply

* Re: [PATCH mlx5-next] net/mlx5: ODP support for XRC transport is not enabled by default in FW
From: Jason Gunthorpe @ 2019-03-06 19:53 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Doug Ledford, Moni Shoua, RDMA mailing list, Saeed Mahameed,
	linux-netdev, Leon Romanovsky
In-Reply-To: <20190225065439.821-1-leon@kernel.org>

On Mon, Feb 25, 2019 at 08:54:39AM +0200, Leon Romanovsky wrote:
> From: Moni Shoua <monis@mellanox.com>
> 
> ODP support for XRC transport is not enabled by default in FW,
> so we need separate ODP checks to enable/disable it.
> 
> While that, rewrite the set of ODP SRQ support capabilities in way
> that tests each field separately for clearness, which is not needed
> for current FW, but better to have it separated.
> 
> Signed-off-by: Moni Shoua <monis@mellanox.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> ---
>  .../net/ethernet/mellanox/mlx5/core/main.c    | 38 +++++++++++--------
>  1 file changed, 22 insertions(+), 16 deletions(-)
> 
> --
> 2.19.1

Applied to for-next, thanks

Jason

^ permalink raw reply

* Re: [PATCH mlx5-next] net/mlx5: Fix DCT creation bad flow
From: Leon Romanovsky @ 2019-03-06 18:57 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Doug Ledford, Yishai Hadas, RDMA mailing list, Artemy Kovalyov,
	Moni Shoua, Saeed Mahameed, linux-netdev
In-Reply-To: <20190306185212.GQ1758@mellanox.com>

On Wed, Mar 06, 2019 at 08:52:16PM +0200, Jason Gunthorpe wrote:
> On Wed, Mar 06, 2019 at 07:20:50PM +0200, Leon Romanovsky wrote:
> > From: Yishai Hadas <yishaih@mellanox.com>
> >
> > In case the DCT creation command has succeeded a DRAIN must be issued
> > before calling DESTROY.
> >
> > In addition, the original code used the wrong parameter for the DESTROY
> > command, 'in' instead of 'din', which caused another creation try
> > instead of destroying.
> >
> > Cc: <stable@vger.kernel.org> # 4.15
> > Fixes: 57cda166bbe0 ("net/mlx5: Add DCT command interface")
> > Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
> > Reviewed-by: Artemy Kovalyov <artemyko@mellanox.com>
> > Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> > Jason, Doug
> >
> > If it is possible, I would like to take this patch too:
> > https://patchwork.kernel.org/patch/10828299/
>
> This should have been applied to the shared tree though??
>
> It is RDMA focused, do you want it to go to the RDMA tree?

Yes, it will be awesome, because net-next is closed, there is no need in
shared tree.

Thanks

>
> Jason

^ permalink raw reply

* Re: [PATCH mlx5-next] net/mlx5: Fix DCT creation bad flow
From: Jason Gunthorpe @ 2019-03-06 18:52 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Doug Ledford, Yishai Hadas, RDMA mailing list, Artemy Kovalyov,
	Moni Shoua, Saeed Mahameed, linux-netdev, Leon Romanovsky
In-Reply-To: <20190306172050.20033-1-leon@kernel.org>

On Wed, Mar 06, 2019 at 07:20:50PM +0200, Leon Romanovsky wrote:
> From: Yishai Hadas <yishaih@mellanox.com>
> 
> In case the DCT creation command has succeeded a DRAIN must be issued
> before calling DESTROY.
> 
> In addition, the original code used the wrong parameter for the DESTROY
> command, 'in' instead of 'din', which caused another creation try
> instead of destroying.
> 
> Cc: <stable@vger.kernel.org> # 4.15
> Fixes: 57cda166bbe0 ("net/mlx5: Add DCT command interface")
> Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
> Reviewed-by: Artemy Kovalyov <artemyko@mellanox.com>
> Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
> Jason, Doug
> 
> If it is possible, I would like to take this patch too:
> https://patchwork.kernel.org/patch/10828299/

This should have been applied to the shared tree though??

It is RDMA focused, do you want it to go to the RDMA tree?

Jason

^ permalink raw reply

* [PATCH] drivers: infiniband: Kconfig: pedantic cleanups
From: Enrico Weigelt, metux IT consult @ 2019-03-06 18:49 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-rdma

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
 drivers/infiniband/hw/bnxt_re/Kconfig | 10 +++++-----
 drivers/infiniband/ulp/iser/Kconfig   |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/infiniband/hw/bnxt_re/Kconfig b/drivers/infiniband/hw/bnxt_re/Kconfig
index 19982a4..05aa9fa 100644
--- a/drivers/infiniband/hw/bnxt_re/Kconfig
+++ b/drivers/infiniband/hw/bnxt_re/Kconfig
@@ -1,9 +1,9 @@
 config INFINIBAND_BNXT_RE
-    tristate "Broadcom Netxtreme HCA support"
-    depends on ETHERNET && NETDEVICES && PCI && INET && DCB
-    select NET_VENDOR_BROADCOM
-    select BNXT
-    ---help---
+	tristate "Broadcom Netxtreme HCA support"
+	depends on ETHERNET && NETDEVICES && PCI && INET && DCB
+	select NET_VENDOR_BROADCOM
+	select BNXT
+	---help---
 	  This driver supports Broadcom NetXtreme-E 10/25/40/50 gigabit
 	  RoCE HCAs.  To compile this driver as a module, choose M here:
 	  the module will be called bnxt_re.
diff --git a/drivers/infiniband/ulp/iser/Kconfig b/drivers/infiniband/ulp/iser/Kconfig
index d00af71..299268f 100644
--- a/drivers/infiniband/ulp/iser/Kconfig
+++ b/drivers/infiniband/ulp/iser/Kconfig
@@ -4,8 +4,8 @@ config INFINIBAND_ISER
 	select SCSI_ISCSI_ATTRS
 	---help---
 	  Support for the iSCSI Extensions for RDMA (iSER) Protocol
-          over InfiniBand. This allows you to access storage devices
-          that speak iSCSI over iSER over InfiniBand.
+	  over InfiniBand. This allows you to access storage devices
+	  that speak iSCSI over iSER over InfiniBand.
 
 	  The iSER protocol is defined by IETF.
 	  See <http://www.ietf.org/rfc/rfc5046.txt>
-- 
1.9.1

^ permalink raw reply related

* Re: [PATCH for-next 3/3] IB/hfi1: Close race condition on user context disable and close
From: Jason Gunthorpe @ 2019-03-06 18:47 UTC (permalink / raw)
  To: Dennis Dalessandro
  Cc: dledford, linux-rdma, Michael J. Ruhl, Mike Marciniszyn, stable
In-Reply-To: <03a0a78b-8ae6-26b2-7d6c-9d605971d975@intel.com>

On Tue, Mar 05, 2019 at 10:30:39AM -0500, Dennis Dalessandro wrote:
> On 3/4/2019 3:41 PM, Jason Gunthorpe wrote:
> > On Tue, Feb 26, 2019 at 12:15:59PM -0500, Dennis Dalessandro wrote:
> > > On 2/26/2019 11:45 AM, Dennis Dalessandro wrote:
> > > >    struct hfi1_ctxtdata *hfi1_rcd_get_by_index(struct hfi1_devdata *dd, u16 ctxt);
> > > > diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c
> > > > index 7841a0a..2cc5164 100644
> > > > +++ b/drivers/infiniband/hw/hfi1/init.c
> > > > @@ -214,12 +214,12 @@ static void hfi1_rcd_free(struct kref *kref)
> > > >    	struct hfi1_ctxtdata *rcd =
> > > >    		container_of(kref, struct hfi1_ctxtdata, kref);
> > > > -	hfi1_free_ctxtdata(rcd->dd, rcd);
> > > > -
> > > >    	spin_lock_irqsave(&rcd->dd->uctxt_lock, flags);
> > > >    	rcd->dd->rcd[rcd->ctxt] = NULL;
> > > >    	spin_unlock_irqrestore(&rcd->dd->uctxt_lock, flags);
> > > > +	hfi1_free_ctxtdata(rcd->dd, rcd);
> > > > +
> > > >    	kfree(rcd);
> > > >    }
> > > Whoops, hold off on pulling this one just yet. We need to take a closer look
> > > at the above hunk.
> > 
> > Oh, okay.. Please resend it
> 
> We've talked it over, it is OK to take after all. Just needed to be sure and
> folks were on vacation last week. If you still have the patch it's good to
> go, if not I'll tack it on my next submit as well.

Okay I grabbed the old one

Jason

^ permalink raw reply

* Re: [PATCH] RDMA/umem: updated bug fix in error handling path
From: Jason Gunthorpe @ 2019-03-06 18:45 UTC (permalink / raw)
  To: john.hubbard
  Cc: linux-mm, Andrew Morton, LKML, John Hubbard, Artemy Kovalyov,
	Leon Romanovsky, Ira Weiny, Doug Ledford, linux-rdma
In-Reply-To: <20190306020022.21828-1-jhubbard@nvidia.com>

On Tue, Mar 05, 2019 at 06:00:22PM -0800, john.hubbard@gmail.com wrote:
> From: John Hubbard <jhubbard@nvidia.com>
> 
> The previous attempted bug fix overlooked the fact that
> ib_umem_odp_map_dma_single_page() was doing a put_page()
> upon hitting an error. So there was not really a bug there.
> 
> Therefore, this reverts the off-by-one change, but
> keeps the change to use release_pages() in the error path.
> 
> Fixes: commit xxxxxxxxxxxx ("RDMA/umem: minor bug fix in error handling path")
> Suggested-by: Artemy Kovalyov <artemyko@mellanox.com>
> 
> Cc: Leon Romanovsky <leon@kernel.org>
> Cc: Ira Weiny <ira.weiny@intel.com>
> Cc: Jason Gunthorpe <jgg@ziepe.ca>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Doug Ledford <dledford@redhat.com>
> Cc: linux-rdma@vger.kernel.org
> Cc: linux-mm@kvack.org
> Signed-off-by: John Hubbard <jhubbard@nvidia.com>
> ---
>  drivers/infiniband/core/umem_odp.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)

Applied to for-next, thanks

Jason

^ permalink raw reply

* [PATCH mlx5-next] IB/mlx5: Use mlx5 core to create/destroy a DEVX DCT
From: Leon Romanovsky @ 2019-03-06 17:21 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe
  Cc: Yishai Hadas, RDMA mailing list, Artemy Kovalyov, Saeed Mahameed,
	linux-netdev, Leon Romanovsky

From: Yishai Hadas <yishaih@mellanox.com>

To prevent a hardware memory leak when a DEVX DCT object is destroyed
without calling DRAIN DCT before, (e.g. under cleanup flow), need to
manage its creation and destruction via mlx5 core.

In that case the DRAIN DCT command will be called and only once that
it will be completed the DESTROY DCT command will be called.
Otherwise, the DESTROY DCT may fail and a hardware leak may occur.

As of that change the DRAIN DCT command should not be exposed any more
from DEVX, it's managed internally by the driver to work as expected by
the device specification.

Fixes: 7efce3691d33 ("IB/mlx5: Add obj create and destroy functionality")
Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Reviewed-by: Artemy Kovalyov <artemyko@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
 drivers/infiniband/hw/mlx5/devx.c            | 34 +++++++++++++++-----
 drivers/infiniband/hw/mlx5/qp.c              |  4 ++-
 drivers/net/ethernet/mellanox/mlx5/core/qp.c |  6 ++--
 include/linux/mlx5/qp.h                      |  3 +-
 4 files changed, 34 insertions(+), 13 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/devx.c b/drivers/infiniband/hw/mlx5/devx.c
index eaa055007f28..9e08df7914aa 100644
--- a/drivers/infiniband/hw/mlx5/devx.c
+++ b/drivers/infiniband/hw/mlx5/devx.c
@@ -20,6 +20,7 @@
 
 enum devx_obj_flags {
 	DEVX_OBJ_FLAGS_INDIRECT_MKEY = 1 << 0,
+	DEVX_OBJ_FLAGS_DCT = 1 << 1,
 };
 
 struct devx_async_data {
@@ -39,7 +40,10 @@ struct devx_obj {
 	u32			dinlen; /* destroy inbox length */
 	u32			dinbox[MLX5_MAX_DESTROY_INBOX_SIZE_DW];
 	u32			flags;
-	struct mlx5_ib_devx_mr	devx_mr;
+	union {
+		struct mlx5_ib_devx_mr	devx_mr;
+		struct mlx5_core_dct	core_dct;
+	};
 };
 
 struct devx_umem {
@@ -347,7 +351,6 @@ static u64 devx_get_obj_id(const void *in)
 		obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_RQ,
 					MLX5_GET(arm_rq_in, in, srq_number));
 		break;
-	case MLX5_CMD_OP_DRAIN_DCT:
 	case MLX5_CMD_OP_ARM_DCT_FOR_KEY_VIOLATION:
 		obj_id = get_enc_obj_id(MLX5_CMD_OP_CREATE_DCT,
 					MLX5_GET(drain_dct_in, in, dctn));
@@ -618,7 +621,6 @@ static bool devx_is_obj_modify_cmd(const void *in)
 	case MLX5_CMD_OP_2RST_QP:
 	case MLX5_CMD_OP_ARM_XRC_SRQ:
 	case MLX5_CMD_OP_ARM_RQ:
-	case MLX5_CMD_OP_DRAIN_DCT:
 	case MLX5_CMD_OP_ARM_DCT_FOR_KEY_VIOLATION:
 	case MLX5_CMD_OP_ARM_XRQ:
 	case MLX5_CMD_OP_SET_XRQ_DC_PARAMS_ENTRY:
@@ -1124,7 +1126,11 @@ static int devx_obj_cleanup(struct ib_uobject *uobject,
 	if (obj->flags & DEVX_OBJ_FLAGS_INDIRECT_MKEY)
 		devx_cleanup_mkey(obj);
 
-	ret = mlx5_cmd_exec(obj->mdev, obj->dinbox, obj->dinlen, out, sizeof(out));
+	if (obj->flags & DEVX_OBJ_FLAGS_DCT)
+		ret = mlx5_core_destroy_dct(obj->mdev, &obj->core_dct);
+	else
+		ret = mlx5_cmd_exec(obj->mdev, obj->dinbox, obj->dinlen, out,
+				    sizeof(out));
 	if (ib_is_destroy_retryable(ret, why, uobject))
 		return ret;
 
@@ -1185,9 +1191,17 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)(
 		devx_set_umem_valid(cmd_in);
 	}
 
-	err = mlx5_cmd_exec(dev->mdev, cmd_in,
-			    cmd_in_len,
-			    cmd_out, cmd_out_len);
+	if (opcode == MLX5_CMD_OP_CREATE_DCT) {
+		obj->flags |= DEVX_OBJ_FLAGS_DCT;
+		err = mlx5_core_create_dct(dev->mdev, &obj->core_dct,
+					   cmd_in, cmd_in_len,
+					   cmd_out, cmd_out_len);
+	} else {
+		err = mlx5_cmd_exec(dev->mdev, cmd_in,
+				    cmd_in_len,
+				    cmd_out, cmd_out_len);
+	}
+
 	if (err)
 		goto obj_free;
 
@@ -1214,7 +1228,11 @@ static int UVERBS_HANDLER(MLX5_IB_METHOD_DEVX_OBJ_CREATE)(
 	if (obj->flags & DEVX_OBJ_FLAGS_INDIRECT_MKEY)
 		devx_cleanup_mkey(obj);
 obj_destroy:
-	mlx5_cmd_exec(obj->mdev, obj->dinbox, obj->dinlen, out, sizeof(out));
+	if (obj->flags & DEVX_OBJ_FLAGS_DCT)
+		mlx5_core_destroy_dct(obj->mdev, &obj->core_dct);
+	else
+		mlx5_cmd_exec(obj->mdev, obj->dinbox, obj->dinlen, out,
+			      sizeof(out));
 obj_free:
 	kfree(obj);
 	return err;
diff --git a/drivers/infiniband/hw/mlx5/qp.c b/drivers/infiniband/hw/mlx5/qp.c
index 6b1f0e76900b..7cd006da1dae 100644
--- a/drivers/infiniband/hw/mlx5/qp.c
+++ b/drivers/infiniband/hw/mlx5/qp.c
@@ -3729,6 +3729,7 @@ static int mlx5_ib_modify_dct(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 
 	} else if (cur_state == IB_QPS_INIT && new_state == IB_QPS_RTR) {
 		struct mlx5_ib_modify_qp_resp resp = {};
+		u32 out[MLX5_ST_SZ_DW(create_dct_out)] = {0};
 		u32 min_resp_len = offsetof(typeof(resp), dctn) +
 				   sizeof(resp.dctn);
 
@@ -3747,7 +3748,8 @@ static int mlx5_ib_modify_dct(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 		MLX5_SET(dctc, dctc, hop_limit, attr->ah_attr.grh.hop_limit);
 
 		err = mlx5_core_create_dct(dev->mdev, &qp->dct.mdct, qp->dct.in,
-					   MLX5_ST_SZ_BYTES(create_dct_in));
+					   MLX5_ST_SZ_BYTES(create_dct_in), out,
+					   sizeof(out));
 		if (err)
 			return err;
 		resp.dctn = qp->dct.mdct.mqp.qpn;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/qp.c b/drivers/net/ethernet/mellanox/mlx5/core/qp.c
index 54cdfb354c0e..be249e675733 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/qp.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/qp.c
@@ -261,16 +261,16 @@ static int _mlx5_core_destroy_dct(struct mlx5_core_dev *dev,
 
 int mlx5_core_create_dct(struct mlx5_core_dev *dev,
 			 struct mlx5_core_dct *dct,
-			 u32 *in, int inlen)
+			 u32 *in, int inlen,
+			 u32 *out, int outlen)
 {
-	u32 out[MLX5_ST_SZ_DW(create_dct_out)]   = {0};
 	struct mlx5_core_qp *qp = &dct->mqp;
 	int err;
 
 	init_completion(&dct->drained);
 	MLX5_SET(create_dct_in, in, opcode, MLX5_CMD_OP_CREATE_DCT);
 
-	err = mlx5_cmd_exec(dev, in, inlen, &out, sizeof(out));
+	err = mlx5_cmd_exec(dev, in, inlen, out, outlen);
 	if (err) {
 		mlx5_core_warn(dev, "create DCT failed, ret %d\n", err);
 		return err;
diff --git a/include/linux/mlx5/qp.h b/include/linux/mlx5/qp.h
index b26ea9077384..0343c81d4c5f 100644
--- a/include/linux/mlx5/qp.h
+++ b/include/linux/mlx5/qp.h
@@ -557,7 +557,8 @@ static inline struct mlx5_core_mkey *__mlx5_mr_lookup(struct mlx5_core_dev *dev,
 
 int mlx5_core_create_dct(struct mlx5_core_dev *dev,
 			 struct mlx5_core_dct *qp,
-			 u32 *in, int inlen);
+			 u32 *in, int inlen,
+			 u32 *out, int outlen);
 int mlx5_core_create_qp(struct mlx5_core_dev *dev,
 			struct mlx5_core_qp *qp,
 			u32 *in,
-- 
2.19.1

^ permalink raw reply related

* [PATCH mlx5-next] net/mlx5: Fix DCT creation bad flow
From: Leon Romanovsky @ 2019-03-06 17:20 UTC (permalink / raw)
  To: Doug Ledford, Jason Gunthorpe
  Cc: Yishai Hadas, RDMA mailing list, Artemy Kovalyov, Moni Shoua,
	Saeed Mahameed, linux-netdev, Leon Romanovsky

From: Yishai Hadas <yishaih@mellanox.com>

In case the DCT creation command has succeeded a DRAIN must be issued
before calling DESTROY.

In addition, the original code used the wrong parameter for the DESTROY
command, 'in' instead of 'din', which caused another creation try
instead of destroying.

Cc: <stable@vger.kernel.org> # 4.15
Fixes: 57cda166bbe0 ("net/mlx5: Add DCT command interface")
Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Reviewed-by: Artemy Kovalyov <artemyko@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
---
Jason, Doug

If it is possible, I would like to take this patch too:
https://patchwork.kernel.org/patch/10828299/

Thanks
---
 drivers/net/ethernet/mellanox/mlx5/core/qp.c | 64 +++++++++++---------
 1 file changed, 34 insertions(+), 30 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/qp.c b/drivers/net/ethernet/mellanox/mlx5/core/qp.c
index 370ca94b6775..54cdfb354c0e 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/qp.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/qp.c
@@ -40,6 +40,9 @@
 #include "mlx5_core.h"
 #include "lib/eq.h"

+static int mlx5_core_drain_dct(struct mlx5_core_dev *dev,
+			       struct mlx5_core_dct *dct);
+
 static struct mlx5_core_rsc_common *
 mlx5_get_rsc(struct mlx5_qp_table *table, u32 rsn)
 {
@@ -227,13 +230,40 @@ static void destroy_resource_common(struct mlx5_core_dev *dev,
 	wait_for_completion(&qp->common.free);
 }

+static int _mlx5_core_destroy_dct(struct mlx5_core_dev *dev,
+				  struct mlx5_core_dct *dct, bool need_cleanup)
+{
+	u32 out[MLX5_ST_SZ_DW(destroy_dct_out)] = {0};
+	u32 in[MLX5_ST_SZ_DW(destroy_dct_in)]   = {0};
+	struct mlx5_core_qp *qp = &dct->mqp;
+	int err;
+
+	err = mlx5_core_drain_dct(dev, dct);
+	if (err) {
+		if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) {
+			goto destroy;
+		} else {
+			mlx5_core_warn(dev, "failed drain DCT 0x%x with error 0x%x\n", qp->qpn, err);
+			return err;
+		}
+	}
+	wait_for_completion(&dct->drained);
+destroy:
+	if (need_cleanup)
+		destroy_resource_common(dev, &dct->mqp);
+	MLX5_SET(destroy_dct_in, in, opcode, MLX5_CMD_OP_DESTROY_DCT);
+	MLX5_SET(destroy_dct_in, in, dctn, qp->qpn);
+	MLX5_SET(destroy_dct_in, in, uid, qp->uid);
+	err = mlx5_cmd_exec(dev, (void *)&in, sizeof(in),
+			    (void *)&out, sizeof(out));
+	return err;
+}
+
 int mlx5_core_create_dct(struct mlx5_core_dev *dev,
 			 struct mlx5_core_dct *dct,
 			 u32 *in, int inlen)
 {
 	u32 out[MLX5_ST_SZ_DW(create_dct_out)]   = {0};
-	u32 din[MLX5_ST_SZ_DW(destroy_dct_in)]   = {0};
-	u32 dout[MLX5_ST_SZ_DW(destroy_dct_out)] = {0};
 	struct mlx5_core_qp *qp = &dct->mqp;
 	int err;

@@ -254,11 +284,7 @@ int mlx5_core_create_dct(struct mlx5_core_dev *dev,

 	return 0;
 err_cmd:
-	MLX5_SET(destroy_dct_in, din, opcode, MLX5_CMD_OP_DESTROY_DCT);
-	MLX5_SET(destroy_dct_in, din, dctn, qp->qpn);
-	MLX5_SET(destroy_dct_in, din, uid, qp->uid);
-	mlx5_cmd_exec(dev, (void *)&in, sizeof(din),
-		      (void *)&out, sizeof(dout));
+	_mlx5_core_destroy_dct(dev, dct, false);
 	return err;
 }
 EXPORT_SYMBOL_GPL(mlx5_core_create_dct);
@@ -323,29 +349,7 @@ static int mlx5_core_drain_dct(struct mlx5_core_dev *dev,
 int mlx5_core_destroy_dct(struct mlx5_core_dev *dev,
 			  struct mlx5_core_dct *dct)
 {
-	u32 out[MLX5_ST_SZ_DW(destroy_dct_out)] = {0};
-	u32 in[MLX5_ST_SZ_DW(destroy_dct_in)]   = {0};
-	struct mlx5_core_qp *qp = &dct->mqp;
-	int err;
-
-	err = mlx5_core_drain_dct(dev, dct);
-	if (err) {
-		if (dev->state == MLX5_DEVICE_STATE_INTERNAL_ERROR) {
-			goto destroy;
-		} else {
-			mlx5_core_warn(dev, "failed drain DCT 0x%x with error 0x%x\n", qp->qpn, err);
-			return err;
-		}
-	}
-	wait_for_completion(&dct->drained);
-destroy:
-	destroy_resource_common(dev, &dct->mqp);
-	MLX5_SET(destroy_dct_in, in, opcode, MLX5_CMD_OP_DESTROY_DCT);
-	MLX5_SET(destroy_dct_in, in, dctn, qp->qpn);
-	MLX5_SET(destroy_dct_in, in, uid, qp->uid);
-	err = mlx5_cmd_exec(dev, (void *)&in, sizeof(in),
-			    (void *)&out, sizeof(out));
-	return err;
+	return _mlx5_core_destroy_dct(dev, dct, true);
 }
 EXPORT_SYMBOL_GPL(mlx5_core_destroy_dct);

^ permalink raw reply related

* Re: [PATCH][next] net/mlx5e: Remove redundant assignment
From: David Miller @ 2019-03-06  3:03 UTC (permalink / raw)
  To: saeedm; +Cc: roid, leon, netdev, gustavo, elibr, linux-rdma, linux-kernel
In-Reply-To: <176546c027a13f39c0dd8d5915b2d16b98637782.camel@mellanox.com>

From: Saeed Mahameed <saeedm@mellanox.com>
Date: Tue, 5 Mar 2019 22:21:39 +0000

> On Mon, 2019-03-04 at 08:26 +0200, Leon Romanovsky wrote:
>> On Sun, Mar 03, 2019 at 03:20:57PM +0000, Roi Dayan wrote:
>> > 
>> > On 02/03/2019 21:39, Gustavo A. R. Silva wrote:
>> > > Remove redundant assignment to tun_entropy->enabled.
>> > > 
>> > > Addesses-Coverity-ID: 1477328 ("Unused value")
>> > > Fixes: 97417f6182f8 ("net/mlx5e: Fix GRE key by controlling port
>> > > tunnel entropy calculation")
>> > 
>> > the commit doesn't fix any real issue but is more of a cleanup.
>> > so I'm not sure if fixes line is relevant or not.
>> > beside that looks ok.
>> 
>> It doesn't matter if it is real issue or not, the code is wrong and
>> should be fixed. This alone is enough to see the Fixes line.
>> 
>> Thanks,
>> Acked-by: Leon Romanovsky <leonro@mellanox.com>
> 
> Acked-by: Saeed Mahameed <saeedm@mellanox.com>
> Dave, Do you think such patch should go to net, or do you want me to
> send it in my next pull request to net-next, once it is open of course
> ?

This feels more like net-next stuff to me, thanks for asking.

^ permalink raw reply

* Re: [PATCH v2] RDMA/umem: minor bug fix and cleanup in error handling paths
From: John Hubbard @ 2019-03-06  2:04 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Artemy Kovalyov, Ira Weiny, john.hubbard@gmail.com,
	linux-mm@kvack.org, Andrew Morton, LKML, Doug Ledford,
	linux-rdma@vger.kernel.org
In-Reply-To: <20190306015123.GB1662@ziepe.ca>

On 3/5/19 5:51 PM, Jason Gunthorpe wrote:
> On Tue, Mar 05, 2019 at 05:37:18PM -0800, John Hubbard wrote:
>> On 3/5/19 5:34 PM, John Hubbard wrote:
>> [snip]
>>>>> So release_pages(&local_page_list[j+1], npages - j-1) would be correct.
>>>>
>>>> Someone send a fixup patch please...
>>>>
>>>> Jason
>>>
>>> Yeah, I'm on it. Just need to double-check that this is the case. But Jason,
>>> you're confirming it already, so that helps too.
> 
> I didn't look, just assuming Artemy is right since he knows this
> code..
> 

OK. And I've confirmed it, too.

>>> Patch coming shortly.
>>>
>>
>> Jason, btw, do you prefer a patch that fixes the previous one, or a new 
>> patch that stands alone? (I'm not sure how this tree is maintained, exactly.)
> 
> It has past the point when I should apply a fixup, rdma is general has
> about an approximately 1 day period after the 'thanks applied' message
> where rebase is possible
> 
> Otherwise the tree is strictly no rebase
> 
> Jason
> 

Got it, patch is posted now.

thanks,
-- 
John Hubbard
NVIDIA

^ permalink raw reply

* [PATCH] RDMA/umem: updated bug fix in error handling path
From: john.hubbard @ 2019-03-06  2:00 UTC (permalink / raw)
  To: linux-mm
  Cc: Andrew Morton, LKML, John Hubbard, Artemy Kovalyov,
	Leon Romanovsky, Ira Weiny, Jason Gunthorpe, Doug Ledford,
	linux-rdma

From: John Hubbard <jhubbard@nvidia.com>

The previous attempted bug fix overlooked the fact that
ib_umem_odp_map_dma_single_page() was doing a put_page()
upon hitting an error. So there was not really a bug there.

Therefore, this reverts the off-by-one change, but
keeps the change to use release_pages() in the error path.

Fixes: commit xxxxxxxxxxxx ("RDMA/umem: minor bug fix in error handling path")
Suggested-by: Artemy Kovalyov <artemyko@mellanox.com>

Cc: Leon Romanovsky <leon@kernel.org>
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Jason Gunthorpe <jgg@ziepe.ca>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Doug Ledford <dledford@redhat.com>
Cc: linux-rdma@vger.kernel.org
Cc: linux-mm@kvack.org
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
 drivers/infiniband/core/umem_odp.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/core/umem_odp.c b/drivers/infiniband/core/umem_odp.c
index d45735b02e07..c9cafaa080e7 100644
--- a/drivers/infiniband/core/umem_odp.c
+++ b/drivers/infiniband/core/umem_odp.c
@@ -686,10 +686,13 @@ int ib_umem_odp_map_dma_pages(struct ib_umem_odp *umem_odp, u64 user_virt,
 
 		if (ret < 0) {
 			/*
-			 * Release pages, starting at the the first page
-			 * that experienced an error.
+			 * Release pages, remembering that the first page
+			 * to hit an error was already released by
+			 * ib_umem_odp_map_dma_single_page().
 			 */
-			release_pages(&local_page_list[j], npages - j);
+			if (npages - (j + 1) > 0)
+				release_pages(&local_page_list[j+1],
+					      npages - (j + 1));
 			break;
 		}
 	}
-- 
2.21.0

^ permalink raw reply related

* Re: [PATCH v2] RDMA/umem: minor bug fix and cleanup in error handling paths
From: Jason Gunthorpe @ 2019-03-06  1:51 UTC (permalink / raw)
  To: John Hubbard
  Cc: Artemy Kovalyov, Ira Weiny, john.hubbard@gmail.com,
	linux-mm@kvack.org, Andrew Morton, LKML, Doug Ledford,
	linux-rdma@vger.kernel.org
In-Reply-To: <be6303c6-d8d2-483a-5271-b6707c21178e@nvidia.com>

On Tue, Mar 05, 2019 at 05:37:18PM -0800, John Hubbard wrote:
> On 3/5/19 5:34 PM, John Hubbard wrote:
> [snip]
> >>> So release_pages(&local_page_list[j+1], npages - j-1) would be correct.
> >>
> >> Someone send a fixup patch please...
> >>
> >> Jason
> > 
> > Yeah, I'm on it. Just need to double-check that this is the case. But Jason,
> > you're confirming it already, so that helps too.

I didn't look, just assuming Artemy is right since he knows this
code..

> > Patch coming shortly.
> > 
> 
> Jason, btw, do you prefer a patch that fixes the previous one, or a new 
> patch that stands alone? (I'm not sure how this tree is maintained, exactly.)

It has past the point when I should apply a fixup, rdma is general has
about an approximately 1 day period after the 'thanks applied' message
where rebase is possible

Otherwise the tree is strictly no rebase

Jason

^ permalink raw reply

* Re: [PATCH v2] RDMA/umem: minor bug fix and cleanup in error handling paths
From: John Hubbard @ 2019-03-06  1:37 UTC (permalink / raw)
  To: Jason Gunthorpe, Artemy Kovalyov
  Cc: Ira Weiny, john.hubbard@gmail.com, linux-mm@kvack.org,
	Andrew Morton, LKML, Doug Ledford, linux-rdma@vger.kernel.org
In-Reply-To: <74f196a1-bd27-2e94-2f9f-0cf657eb0c91@nvidia.com>

On 3/5/19 5:34 PM, John Hubbard wrote:
[snip]
>>> So release_pages(&local_page_list[j+1], npages - j-1) would be correct.
>>
>> Someone send a fixup patch please...
>>
>> Jason
> 
> Yeah, I'm on it. Just need to double-check that this is the case. But Jason,
> you're confirming it already, so that helps too.
> 
> Patch coming shortly.
> 

Jason, btw, do you prefer a patch that fixes the previous one, or a new 
patch that stands alone? (I'm not sure how this tree is maintained, exactly.)

thanks,
-- 
John Hubbard
NVIDIA

^ permalink raw reply

* Re: [PATCH v2] RDMA/umem: minor bug fix and cleanup in error handling paths
From: John Hubbard @ 2019-03-06  1:34 UTC (permalink / raw)
  To: Jason Gunthorpe, Artemy Kovalyov
  Cc: Ira Weiny, john.hubbard@gmail.com, linux-mm@kvack.org,
	Andrew Morton, LKML, Doug Ledford, linux-rdma@vger.kernel.org
In-Reply-To: <20190306013213.GA1662@ziepe.ca>

On 3/5/19 5:32 PM, Jason Gunthorpe wrote:
> On Wed, Mar 06, 2019 at 03:02:36AM +0200, Artemy Kovalyov wrote:
>>
>>
>> On 04/03/2019 00:37, John Hubbard wrote:
>>> On 3/3/19 1:52 AM, Artemy Kovalyov wrote:
>>>>
>>>>
>>>> On 02/03/2019 21:44, Ira Weiny wrote:
>>>>>
>>>>> On Sat, Mar 02, 2019 at 12:24:35PM -0800, john.hubbard@gmail.com wrote:
>>>>>> From: John Hubbard <jhubbard@nvidia.com>
>>>>>>
>>>>>> ...
>>>
>>> OK, thanks for explaining! Artemy, while you're here, any thoughts about the
>>> release_pages, and the change of the starting point, from the other part of the
>>> patch:
>>>
>>> @@ -684,9 +677,11 @@ int ib_umem_odp_map_dma_pages(struct ib_umem_odp *umem_odp,
>>> u64 user_virt,
>>> 	mutex_unlock(&umem_odp->umem_mutex);
>>>
>>>    		if (ret < 0) {
>>> -			/* Release left over pages when handling errors. */
>>> -			for (++j; j < npages; ++j)
>> release_pages() is an optimized batch put_page() so it's ok.
>> but! release starting from page next to one cause failure in
>> ib_umem_odp_map_dma_single_page() is correct because failure flow of this
>> functions already called put_page().
>> So release_pages(&local_page_list[j+1], npages - j-1) would be correct.
> 
> Someone send a fixup patch please...
> 
> Jason

Yeah, I'm on it. Just need to double-check that this is the case. But Jason,
you're confirming it already, so that helps too.

Patch coming shortly.

thanks,
-- 
John Hubbard
NVIDIA

^ permalink raw reply

* Re: [PATCH v2] RDMA/umem: minor bug fix and cleanup in error handling paths
From: Jason Gunthorpe @ 2019-03-06  1:32 UTC (permalink / raw)
  To: Artemy Kovalyov
  Cc: John Hubbard, Ira Weiny, john.hubbard@gmail.com,
	linux-mm@kvack.org, Andrew Morton, LKML, Doug Ledford,
	linux-rdma@vger.kernel.org
In-Reply-To: <903383a6-f2c9-4a69-83c0-9be9c052d4be@mellanox.com>

On Wed, Mar 06, 2019 at 03:02:36AM +0200, Artemy Kovalyov wrote:
> 
> 
> On 04/03/2019 00:37, John Hubbard wrote:
> > On 3/3/19 1:52 AM, Artemy Kovalyov wrote:
> > > 
> > > 
> > > On 02/03/2019 21:44, Ira Weiny wrote:
> > > > 
> > > > On Sat, Mar 02, 2019 at 12:24:35PM -0800, john.hubbard@gmail.com wrote:
> > > > > From: John Hubbard <jhubbard@nvidia.com>
> > > > > 
> > > > > ...
> > 
> > OK, thanks for explaining! Artemy, while you're here, any thoughts about the
> > release_pages, and the change of the starting point, from the other part of the
> > patch:
> > 
> > @@ -684,9 +677,11 @@ int ib_umem_odp_map_dma_pages(struct ib_umem_odp *umem_odp,
> > u64 user_virt,
> > 	mutex_unlock(&umem_odp->umem_mutex);
> > 
> >    		if (ret < 0) {
> > -			/* Release left over pages when handling errors. */
> > -			for (++j; j < npages; ++j)
> release_pages() is an optimized batch put_page() so it's ok.
> but! release starting from page next to one cause failure in
> ib_umem_odp_map_dma_single_page() is correct because failure flow of this
> functions already called put_page().
> So release_pages(&local_page_list[j+1], npages - j-1) would be correct.

Someone send a fixup patch please...

Jason

^ permalink raw reply

* Re: [PATCH v2] RDMA/umem: minor bug fix and cleanup in error handling paths
From: Artemy Kovalyov @ 2019-03-06  1:02 UTC (permalink / raw)
  To: John Hubbard, Ira Weiny, john.hubbard@gmail.com
  Cc: linux-mm@kvack.org, Andrew Morton, LKML, Jason Gunthorpe,
	Doug Ledford, linux-rdma@vger.kernel.org
In-Reply-To: <332021c5-ab72-d54f-85c8-b2b12b76daed@nvidia.com>



On 04/03/2019 00:37, John Hubbard wrote:
> On 3/3/19 1:52 AM, Artemy Kovalyov wrote:
>>
>>
>> On 02/03/2019 21:44, Ira Weiny wrote:
>>>
>>> On Sat, Mar 02, 2019 at 12:24:35PM -0800, john.hubbard@gmail.com wrote:
>>>> From: John Hubbard <jhubbard@nvidia.com>
>>>>
>>>> ...
> 
> OK, thanks for explaining! Artemy, while you're here, any thoughts about the
> release_pages, and the change of the starting point, from the other part of the
> patch:
> 
> @@ -684,9 +677,11 @@ int ib_umem_odp_map_dma_pages(struct ib_umem_odp *umem_odp,
> u64 user_virt,
> 	mutex_unlock(&umem_odp->umem_mutex);
> 
>    		if (ret < 0) {
> -			/* Release left over pages when handling errors. */
> -			for (++j; j < npages; ++j)
release_pages() is an optimized batch put_page() so it's ok.
but! release starting from page next to one cause failure in 
ib_umem_odp_map_dma_single_page() is correct because failure flow of 
this functions already called put_page().
So release_pages(&local_page_list[j+1], npages - j-1) would be correct.
> -				put_page(local_page_list[j]);
> +			/*
> +			 * Release pages, starting at the the first page
> +			 * that experienced an error.
> +			 */
> +			release_pages(&local_page_list[j], npages - j);
>    			break;
>    		}
>    	}
> 
> ?
> 
> thanks,
> 

^ permalink raw reply

* Re: [PATCH][next] net/mlx5e: Remove redundant assignment
From: Saeed Mahameed @ 2019-03-05 22:21 UTC (permalink / raw)
  To: Roi Dayan, leon@kernel.org
  Cc: davem@davemloft.net, netdev@vger.kernel.org,
	gustavo@embeddedor.com, Eli Britstein, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org
In-Reply-To: <20190304062645.GZ15253@mtr-leonro.mtl.com>

On Mon, 2019-03-04 at 08:26 +0200, Leon Romanovsky wrote:
> On Sun, Mar 03, 2019 at 03:20:57PM +0000, Roi Dayan wrote:
> > 
> > On 02/03/2019 21:39, Gustavo A. R. Silva wrote:
> > > Remove redundant assignment to tun_entropy->enabled.
> > > 
> > > Addesses-Coverity-ID: 1477328 ("Unused value")
> > > Fixes: 97417f6182f8 ("net/mlx5e: Fix GRE key by controlling port
> > > tunnel entropy calculation")
> > 
> > the commit doesn't fix any real issue but is more of a cleanup.
> > so I'm not sure if fixes line is relevant or not.
> > beside that looks ok.
> 
> It doesn't matter if it is real issue or not, the code is wrong and
> should be fixed. This alone is enough to see the Fixes line.
> 
> Thanks,
> Acked-by: Leon Romanovsky <leonro@mellanox.com>

Acked-by: Saeed Mahameed <saeedm@mellanox.com>
Dave, Do you think such patch should go to net, or do you want me to
send it in my next pull request to net-next, once it is open of course
?

^ permalink raw reply


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