[ofa-general] libipath crash

Robert Pearson rpearson at systemfabricworks.com
Sat Nov 24 09:43:56 PST 2007


The following test case will cause system crash on 1.2.5.1 if run a few
times with an ipath device but not with an mthca device. I noticed some
recent fixes to ibv_resize_cq but did not see anything about ibv_create_cq.

#include <stdio.h>
#include <infiniband/verbs.h>

int main(int argc, char *argv[])
{
        int num_hca;
        int ret;
        int cqe;
        int max_cqe;
        int i;

        struct ibv_device **device_list;
        struct ibv_context *context;
        struct ibv_device_attr device_attr;
        struct ibv_cq *cq;

        srandom((unsigned int)time(NULL));

        if ((device_list = ibv_get_device_list(&num_hca)) == NULL) {
                printf("unable to get device list\n");
                return 1;
        }

        if (num_hca == 0) {
                printf("no HCAs\n");
                return 1;
        }

        if ((context = ibv_open_device(device_list[0])) == NULL) {
                printf("unable to open device\n");
                return 1;
        }

        if ((ret = ibv_query_device(context, &device_attr)) != 0) {
                printf("unable to query device\n");
                return 1;
        }

        max_cqe = 100000;

        if (max_cqe > device_attr.max_cqe)
                max_cqe = device_attr.max_cqe;

        for (i = 0; i < 1000; i++) {
                cqe = ((int)random() % max_cqe) + 1;

                printf("cqe = %d\n", cqe); fflush(stdout);

                if ((cq = ibv_create_cq(context, cqe, NULL, NULL, 0))
                        == NULL) {
                        printf("unable to create cq\n");
                        return 1;
                }

                if ((ret = ibv_destroy_cq(cq)) != 0) {
                        printf("unable to destroy cq\n");
                        return 1;
                }
        }

        printf("passed\n");

        return 0;
}

Bob Pearson



More information about the general mailing list