Message ID | 1467201583-4892-3-git-send-email-bill.fischofer@linaro.org |
---|---|
State | Accepted |
Commit | e9d434fd193e501ef9ca69f530ce4e5f9448594d |
Headers | show |
OK, This part wasn't relevant to the bug fix. Maxim: consider Part 2 withdrawn and we can apply Part 1 to fix the Coverity issue. On Wed, Jun 29, 2016 at 7:39 AM, Savolainen, Petri (Nokia - FI/Espoo) < petri.savolainen@nokia-bell-labs.com> wrote: > I think that there should be another test which tries to create all those > millions of queues (reserve memory for handles from shm) and try to > enqueue event through those. This one should be simple test to see if > capability API there or not. > > System may stuck before malloc fails. > > -Petri > > > > > -----Original Message----- > > From: lng-odp [mailto:lng-odp-bounces@lists.linaro.org] On Behalf Of > Bill > > Fischofer > > Sent: Wednesday, June 29, 2016 3:00 PM > > To: lng-odp@lists.linaro.org > > Subject: [lng-odp] [PATCHv3 2/2] validation: queue: use malloc to avoid > > limits on max_queues > > > > odp_queue_capability() returns max_queues which may be more than 64K. > > Use malloc to allocate an array of queue handles to test the ability to > > create max_queues to avoid limiting the test to 64K queues. If this > malloc > > fails then attempt a reduced test with 64K queues. > > > > Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> > > --- > > test/validation/queue/queue.c | 15 +++++++++++---- > > 1 file changed, 11 insertions(+), 4 deletions(-) > > > > diff --git a/test/validation/queue/queue.c > b/test/validation/queue/queue.c > > index 96941f4..2c8658e 100644 > > --- a/test/validation/queue/queue.c > > +++ b/test/validation/queue/queue.c > > @@ -55,7 +55,7 @@ void queue_test_capa(void) > > odp_queue_capability_t capa; > > odp_queue_param_t qparams; > > char name[ODP_QUEUE_NAME_LEN]; > > - odp_queue_t queue[MAX_QUEUES]; > > + odp_queue_t *queue; > > uint32_t num_queues, i; > > > > memset(&capa, 0, sizeof(odp_queue_capability_t)); > > @@ -71,10 +71,15 @@ void queue_test_capa(void) > > > > name[ODP_QUEUE_NAME_LEN - 1] = 0; > > > > - if (capa.max_queues > MAX_QUEUES) > > + num_queues = capa.max_queues; > > + queue = malloc(num_queues * sizeof(odp_queue_t)); > > + if (queue == NULL) { > > + printf("Unable to alloc %d queues, trying with %d\n", > > + num_queues, MAX_QUEUES); > > num_queues = MAX_QUEUES; > > - else > > - num_queues = capa.max_queues; > > + queue = malloc(num_queues * sizeof(odp_queue_t)); > > + CU_ASSERT_FATAL(queue != NULL); > > + } > > > > odp_queue_param_init(&qparams); > > > > @@ -93,6 +98,8 @@ void queue_test_capa(void) > > > > for (i = 0; i < num_queues; i++) > > CU_ASSERT(odp_queue_destroy(queue[i]) == 0); > > + > > + free(queue); > > } > > > > void queue_test_mode(void) > > -- > > 2.7.4 > > > > _______________________________________________ > > lng-odp mailing list > > lng-odp@lists.linaro.org > > https://lists.linaro.org/mailman/listinfo/lng-odp >
diff --git a/test/validation/queue/queue.c b/test/validation/queue/queue.c index 96941f4..2c8658e 100644 --- a/test/validation/queue/queue.c +++ b/test/validation/queue/queue.c @@ -55,7 +55,7 @@ void queue_test_capa(void) odp_queue_capability_t capa; odp_queue_param_t qparams; char name[ODP_QUEUE_NAME_LEN]; - odp_queue_t queue[MAX_QUEUES]; + odp_queue_t *queue; uint32_t num_queues, i; memset(&capa, 0, sizeof(odp_queue_capability_t)); @@ -71,10 +71,15 @@ void queue_test_capa(void) name[ODP_QUEUE_NAME_LEN - 1] = 0; - if (capa.max_queues > MAX_QUEUES) + num_queues = capa.max_queues; + queue = malloc(num_queues * sizeof(odp_queue_t)); + if (queue == NULL) { + printf("Unable to alloc %d queues, trying with %d\n", + num_queues, MAX_QUEUES); num_queues = MAX_QUEUES; - else - num_queues = capa.max_queues; + queue = malloc(num_queues * sizeof(odp_queue_t)); + CU_ASSERT_FATAL(queue != NULL); + } odp_queue_param_init(&qparams); @@ -93,6 +98,8 @@ void queue_test_capa(void) for (i = 0; i < num_queues; i++) CU_ASSERT(odp_queue_destroy(queue[i]) == 0); + + free(queue); } void queue_test_mode(void)
odp_queue_capability() returns max_queues which may be more than 64K. Use malloc to allocate an array of queue handles to test the ability to create max_queues to avoid limiting the test to 64K queues. If this malloc fails then attempt a reduced test with 64K queues. Signed-off-by: Bill Fischofer <bill.fischofer@linaro.org> --- test/validation/queue/queue.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)