From patchwork Wed Jul 30 13:26:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stuart Haslam X-Patchwork-Id: 34524 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f69.google.com (mail-qg0-f69.google.com [209.85.192.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 3304820DCC for ; Wed, 30 Jul 2014 13:26:58 +0000 (UTC) Received: by mail-qg0-f69.google.com with SMTP id a108sf2299649qge.4 for ; Wed, 30 Jul 2014 06:26:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:message-id:references :mime-version:in-reply-to:user-agent:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list:content-disposition :content-type:content-transfer-encoding; bh=aMQr7uT4BqyM2Gcbv8B+hn4e1zyJaI0XmDQYfpvCgeE=; b=NQMidsC/FIo+KauWtLqmTfLIQ8kaJrxT7DVV69Lgc6DgwDAjFiF6axe9uBV8hUvbYd JW3QE3m+k5MchxlQpFy1i6QihhSfovJjLt7SGQeo4LwT/2By/V0ohmRPGjlSCDJQjqj3 VvsHmNAW6WdkzTdxn9Psry1F8fZF+ss7vst2LJ/yTvyma13Wy8QVDeRI1SsxYOEp53Lv 2XDov1SGcxnOBOdJJaC5O4++3b3GZc/PwKEE2hhagOahn1lYBFuVuHsRxGnNhd2IE1kA bUQZ7oj3fGQhIX/pwq0HTBsOtdQGtJ8T6zaRM/upMdTg6SOSgO4SKO4CGhRT91WHzleK UQUg== X-Gm-Message-State: ALoCoQnrVizj6zrSNFDmJpwUaN7aqx1uO2aFqZnrP2ws6nyxH5N5wCstdgYBUphELEppa63JJnzg X-Received: by 10.236.87.210 with SMTP id y58mr1419809yhe.38.1406726818002; Wed, 30 Jul 2014 06:26:58 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.25.21 with SMTP id 21ls511854qgs.58.gmail; Wed, 30 Jul 2014 06:26:57 -0700 (PDT) X-Received: by 10.220.182.1 with SMTP id ca1mr4257222vcb.21.1406726817857; Wed, 30 Jul 2014 06:26:57 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id 2si1597996vdm.88.2014.07.30.06.26.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 30 Jul 2014 06:26:57 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id le20so1749034vcb.14 for ; Wed, 30 Jul 2014 06:26:57 -0700 (PDT) X-Received: by 10.52.37.81 with SMTP id w17mr1038025vdj.95.1406726817324; Wed, 30 Jul 2014 06:26:57 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp27485vcb; Wed, 30 Jul 2014 06:26:57 -0700 (PDT) X-Received: by 10.224.7.193 with SMTP id e1mr7022419qae.74.1406726816676; Wed, 30 Jul 2014 06:26:56 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id j21si3854336qgd.115.2014.07.30.06.26.56 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 30 Jul 2014 06:26:56 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XCTuB-0007aW-Rk; Wed, 30 Jul 2014 13:26:55 +0000 Received: from service87.mimecast.com ([91.220.42.44]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1XCTu5-0007aR-BP for lng-odp@lists.linaro.org; Wed, 30 Jul 2014 13:26:49 +0000 Received: from cam-owa2.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.21]) by service87.mimecast.com; Wed, 30 Jul 2014 14:26:48 +0100 Received: from localhost ([10.1.255.212]) by cam-owa2.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 30 Jul 2014 14:26:48 +0100 Date: Wed, 30 Jul 2014 14:26:39 +0100 From: Stuart Haslam To: Santosh Shukla Message-ID: <20140730132639.GA27986@localhost> References: MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-OriginalArrivalTime: 30 Jul 2014 13:26:48.0216 (UTC) FILETIME=[EA3DD180:01CFABF9] X-MC-Unique: 114073014264800401 Cc: lng-odp-forward Subject: Re: [lng-odp] [BUG] wrong thread_id entry in thread_tbl[hereee!!!] for few odp applications X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: lng-odp-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: stuart.haslam@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.169 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Content-Disposition: inline On Wed, Jul 30, 2014 at 12:10:24PM +0100, Santosh Shukla wrote: > Hi, > > I noticed that few example odp application (l2fwd, generator, pktio > and odp_timer_ping) likely to store wrong thread_id because of the way > they were using odp_linux_pthread_create() api. > > Example: > > Refer file example/l2fwd/odp_l2fwd.c, odp_generator.c and odp_time_ping.c > > code snippet look like this > > for (i = 0; i < num_workers; ++i) { > > ............... > ............. > odp_linux_pthread_create(thread_tbl, 1, core, thr_run_func, > &gbl_args->thread[i]); > } > The above will overwrite thread_tbl[0] for each iteration. > > So if you print thread_tbl[] array, you will find only thread_tbl[0] > with valid value and rest with zero. > > Problem is inner for loop of odp_linux_pthread_create() refills entry > in thread_tbl starting from index 0 till max number (arg3 above) > > In my isolation case as well other cases like generator, l2fwd app, > don't want odp_linux_pthread_create to fill thread_tbl entry starting > from 0 everytime. This looks like a bug in the application rather than in the API or the implementation. Why not just pass the correct address from the application? As far as I can tell, this (completely untested) patch would have the same effect as yours; --- Stuart. diff --git a/test/api_test/odp_timer_ping.c b/test/api_test/odp_timer_ping.c index cd67e0d..88650d6 100644 --- a/test/api_test/odp_timer_ping.c +++ b/test/api_test/odp_timer_ping.c @@ -367,7 +367,7 @@ int main(int argc ODP_UNUSED, char *argv[] ODP_UNUSED) run_thread = send_ping; /* Create and launch worker threads */ - odp_linux_pthread_create(thread_tbl, 1, i, + odp_linux_pthread_create(&thread_tbl[i], 1, i, run_thread, (pthrd_arg *)&pingarg); }