I'm working on some sample programs and I've run into a weird problem with 
libibverbs. If I have a simple program linked with libibverbs, things worked 
smoothly, but if I more those functions into a shared library which then calls 
libibverbs, I core dump, with what appears to be a corrupted call stack.

Are there special flags I need to use when creating an SO that works with 
libibverbs?

Here's what I mean:

    hca = open_device(argv[optind]); // value of hca is 0x5054a0.
    if (!hca) {
        fprintf(stderr, "Could not open HCA.\n");
        return -1;
    }
    {
        struct ibv_device_attr attr;
        ibv_query_device(hca,&attr); // this call completes successfully.

        fprintf(stderr,"MHEINZ: Firmware = %s\n",
                attr.fw_ver);
    }

   err = my_shared_func(hca);

   ...

int my_shared_func(struct ibv_context *hca)
{
    struct ibv_device_attr attr;

    hca_context->ops.query_device(hca_context, &attr); // This works!

    ibv_query_device(hca_context,&attr); // core dump here.

    fprintf(stderr,"MHEINZ: Firmware = %s\n",
            attr.fw_ver);

    return 0;
}

First, note that calling the device query directly, by using the function 
pointers in hca_context, works - so I know that the value of hca_context is 
correct. On the other hand, at the point of the core dump, gdb reports that 
inside ibv_query_device, the value of hca_context has changed from 0x5044a0 to 
0x2b46392fb310!

--
Michael Heinz
Principal Engineer, Qlogic Corporation
King of Prussia, Pennsylvania
_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to