Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1364525

Summary: [RHEL7] libmlx5: post_send incorrectly returns errors in errno rather than return value
Product: Red Hat Enterprise Linux 7 Reporter: Dr. David Alan Gilbert <dgilbert>
Component: libmlx5Assignee: Jarod Wilson <jarod>
Status: CLOSED ERRATA QA Contact: Mike Stowell <mstowell>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: ddutile, jshortt, kheib, mstowell, rdma-dev-team, yishaih, zguo
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libmlx5-1.2.1-8.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-04 03:27:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1274397, 1356959    

Description Dr. David Alan Gilbert 2016-08-05 15:19:56 UTC
Description of problem:
This was found with a qemu rdma migration failing with an mlx5 card on power.

QEMU is seeing calls to ibv_post_send return -1 with errno=12 (ENOMEM),
yet the man page for ibv_post_send says:

   RETURN VALUE
       ibv_post_send() returns 0 on success, or the value of errno on failure 
       (which indicates  the  failure  reason).

QEMU is checking the return value to see if it's ENOMEM and then waiting for completion and retrying; but with mlx5 it's not seeing this so ends up dropping requests and hanging.

Looking at libmlx5 source I see:

src/qp.c: _mlx5_post_send circa line 594:
                        errno = ENOMEM;
                        err = -1;
                        *bad_wr = wr;
                        goto out;

then out:  eventually has a return err.
If you compare that with libmlx4 qp.c/mlx4_post_send  it sets ret = ENOMEM and returns ret which matches what the man page says.

Version-Release number of selected component (if applicable):
libmlx5-1.2.1-6.el7.ppc64le

How reproducible:
100%

Steps to Reproduce:
1. Take two power boxes with mlx5 cards (might work on x86 not tried)
2. On one run /usr/libexec/qemu-kvm -M pseries -cpu host --enable-kvm -m 8192 -smp 4 -nographic -incoming rdma:XXX:4444     where XXX is the IP address of the boxes own IB card.
3. on the other host run   usr/libexec/qemu-kvm -M pseries -cpu host --enable-kvm -m 8192 -smp 4 -nographic
   then when it stops printing boot messages type:
     ctrl-a c     which gives you a (qemu) prompt
   (qemu) migrate_set_capability rdma-pin-all on
   (qemu) migrate_set_speed 40G
   (qemu) migrate rdma:XXX:4444      same IP as above


Actual results:
It hangs

Expected results:
It completes and 'info migrate' shows completed.

Additional info:

Comment 1 Jarod Wilson 2016-08-05 16:47:04 UTC
At a glance, I'm pretty sure _mlx5_post_send() shouldn't have both errno and err, it should pick one or the other, rather than trying to maintain both. I'm thinking setting errno in this function should be eliminated, and err should be set to the value errno was being set to, so we get proper returns of EINVAL and ENOMEM instead of -1. Proposed patch incoming to linux-rdma list.

Comment 3 Jarod Wilson 2016-08-06 02:36:19 UTC
Patch sent upstream 2016.08.05.

Comment 4 yishaih 2016-08-11 12:03:08 UTC
V3 was applied upstream, please take it from my formal libmlx5 GIT and verify.

Comment 5 Jarod Wilson 2016-08-11 16:50:43 UTC
Done. Thanks much!

Comment 10 errata-xmlrpc 2016-11-04 03:27:16 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHEA-2016-2309.html