From patchwork Tue Oct 13 11:13:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: hongbo.zhang@freescale.com X-Patchwork-Id: 54840 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id 7C3A420490 for ; Tue, 13 Oct 2015 11:39:18 +0000 (UTC) Received: by wijq8 with SMTP id q8sf8953915wij.1 for ; Tue, 13 Oct 2015 04:39:17 -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:delivered-to:from:to:date :message-id:in-reply-to:references:mime-version:spamdiagnosticoutput :spamdiagnosticmetadata:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :content-type:content-transfer-encoding:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=jEsg0etJ5qvaW6BMUFe5/+rRx5+3diqyxk6W+hbRyKY=; b=gv4B/1Pcw6ECKFWdMQgkXZazOAa7VwZrQFNuMpfmg99yoUxYMUVVHfHvXS7Z62F/aA OWFD0FHlUs+ahSfj/RPm+qtVWL7r5Nqt424m/vrKDcDjMH72tR/j38II3VO7urF1M3oR Evz2bT5d9tu8mSSftg0Bo/jM/7/K1JpvX0MG9KOvraAMRG9JHcOlosgnwm6a24WqS+hL mPsg3yQxNBHCcH63sKEtcVHlqShK2krXnnHtlimeleh/6HBwWvkEB7yVAen1iSqSDdIB 2v6gYT81O8jx1elWQQiqcndWXRYHvIwL7qgzr54+EWksJo3FQhz00dCTh7r19QtmhV4V vCXg== X-Gm-Message-State: ALoCoQlLzWRfqo3LIinMdiMUseO7qpPyUbZaUzeR9O7zOxOHL7b96hsqgSGanV0kfatWMuGmW4g/ X-Received: by 10.180.208.7 with SMTP id ma7mr4119310wic.5.1444736357804; Tue, 13 Oct 2015 04:39:17 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.25.147.7 with SMTP id v7ls570632lfd.65.gmail; Tue, 13 Oct 2015 04:39:17 -0700 (PDT) X-Received: by 10.112.163.99 with SMTP id yh3mr14814186lbb.121.1444736357664; Tue, 13 Oct 2015 04:39:17 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id sk1si1899462lbb.44.2015.10.13.04.39.17 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Oct 2015 04:39:17 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lbcao8 with SMTP id ao8so16299798lbc.3 for ; Tue, 13 Oct 2015 04:39:17 -0700 (PDT) X-Received: by 10.112.163.131 with SMTP id yi3mr14736754lbb.36.1444736357559; Tue, 13 Oct 2015 04:39:17 -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.112.59.35 with SMTP id w3csp2076793lbq; Tue, 13 Oct 2015 04:39:16 -0700 (PDT) X-Received: by 10.140.99.117 with SMTP id p108mr38231956qge.91.1444736356581; Tue, 13 Oct 2015 04:39:16 -0700 (PDT) Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id 66si2426276qgm.14.2015.10.13.04.39.16; Tue, 13 Oct 2015 04:39:16 -0700 (PDT) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Received: by lists.linaro.org (Postfix, from userid 109) id 3EE6B61A22; Tue, 13 Oct 2015 11:39:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 5CEE261B56; Tue, 13 Oct 2015 11:33:29 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 82FE061A21; Tue, 13 Oct 2015 11:33:18 +0000 (UTC) Received: from na01-bn1-obe.outbound.protection.outlook.com (mail-bn1on0110.outbound.protection.outlook.com [157.56.110.110]) by lists.linaro.org (Postfix) with ESMTPS id 5ECE461A4B for ; Tue, 13 Oct 2015 11:31:57 +0000 (UTC) Received: from CO2PR03CA0035.namprd03.prod.outlook.com (10.141.194.162) by BL2PR03MB484.namprd03.prod.outlook.com (10.141.92.152) with Microsoft SMTP Server (TLS) id 15.1.293.16; Tue, 13 Oct 2015 11:31:56 +0000 Received: from BY2FFO11FD036.protection.gbl (2a01:111:f400:7c0c::141) by CO2PR03CA0035.outlook.office365.com (2a01:111:e400:1414::34) with Microsoft SMTP Server (TLS) id 15.1.286.15 via Frontend Transport; Tue, 13 Oct 2015 11:31:55 +0000 Received-SPF: Fail (protection.outlook.com: domain of freescale.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD036.mail.protection.outlook.com (10.1.14.221) with Microsoft SMTP Server (TLS) id 15.1.293.9 via Frontend Transport; Tue, 13 Oct 2015 11:31:55 +0000 Received: from hongbo.ap.freescale.net (hongbo.ap.freescale.net [10.193.20.96]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id t9DBVOFs009638; Tue, 13 Oct 2015 04:31:52 -0700 From: To: Date: Tue, 13 Oct 2015 19:13:14 +0800 Message-ID: <1444734798-29063-11-git-send-email-hongbo.zhang@freescale.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1444734798-29063-1-git-send-email-hongbo.zhang@freescale.com> References: <1444734798-29063-1-git-send-email-hongbo.zhang@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD036; 1:Sv7X8iHfADNtU0S5RFQW8cBlBx8tNveHQCCjDcbs0/2vhMUI1X5muzXPRsus1qOYtral10xyMiC3QykS+MfYYp+mbgMrmcBxbyOpqVOKQKGyLg+r3XEEws5QMERei1AB8MhJO3jRKRsxYKaKXr5JPxdrEANHNalFr6F3u99c2zryhwITd9/uv7ixUes6b3JLptMgxOFi28f6s/bmhhqkCCxgOe1viXaaebAsMz9GCTCxTLicunjpw2b3xsrdJcOvppUXGsBhhdOelkn5Gz7cr3W3eQ74onFqxHoqKOLnrdg/aW66x6QXPIIPnIGzJ6hG7WHPl4T7pdxX5lQk5GADCRjGw8nFw/Ixt0O7kZwIZqUoER4wjxkXd2AO3nTfe7j89cWprgQCj8ZXC9MiBudk3w== X-Forefront-Antispam-Report: CIP:192.88.168.50; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(36756003)(5008740100001)(86362001)(50986999)(11100500001)(50226001)(104016004)(76176999)(2950100001)(5007970100001)(92566002)(6806005)(47776003)(64706001)(2351001)(229853001)(87936001)(81156007)(77096005)(106466001)(5001960100002)(5003940100001)(105606002)(110136002)(50466002)(97736004)(46102003)(85426001)(33646002)(48376002)(19580395003)(189998001)(86152002)(19580405001)(217873001); DIR:OUT; SFP:1102; SCL:1; SRVR:BL2PR03MB484; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB484; 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mN/3E+WYcm7uTD2Jmk3hlMoRGOu4+Wd1OkjfGICtsxybb5QMskAr2thLdHu8=; 4:c9Gb0AlnHNI9aNy0QS/PI+kX2xsN8B0to2OKnIjQx7bsWqLNYWW1FqJliIXxP0uGbl1RpkIOb2OF36BVnc20Ty9EW9bbDlI4zJ8pXspWbHZFsx155zhK1Cv1sk2Vjr+8X4Atk0FQwakO7E0sfHJ+NvS1f2ylZ37vbtwio+XSCyByBZ4qMlU7Lb5cnKXdXo0S4zxUo3zcOTgr7M2KmZ4gXV0NmW8lS3o957+q7JVAXMDI+1631wGnj+RPR0D58C5JhZJkfEPiGb/rwaZguVLl/tcQ6IBYD5EnX2lOwUxzoXEgED311UQGcA97oli8JMhMptyTu14F7E+pRRjUnw/A7NEZd2NTZrZh1LQhIU/REis= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(3002001); SRVR:BL2PR03MB484; BCL:0; PCL:0; RULEID:; SRVR:BL2PR03MB484; X-Forefront-PRVS: 07283408BE X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BL2PR03MB484; 23:xs11DDZHoFdN8v3frw4Mhs7J++1KDaJO+RfnlNCDOj?= =?us-ascii?Q?7q9CosNKFCCT03BJEv1J1Rj3kFskdHZ75a7ts4V9gIwTyiT/liAsNgdI4QMV?= =?us-ascii?Q?GfpC6Og6Qq6B7fy520JuNvHMyO7oHnAMYaHoKPBU4mtvw2i3gaPFIqaXfzWo?= =?us-ascii?Q?SpDnXd3ye0KDrGACjMVq+PdhN1mx30lBnrNqO0dcS0fARJNIXgBKPz/az4/h?= =?us-ascii?Q?+IIJIWTYFmYdGAK+kgrFBKNSR/x9Q+1i0lxQisECeeZ488+wDCcFcXEpt533?= =?us-ascii?Q?e9igDPoI1WsA0X8j0nrC/L5kWdM01i9fFCWYK7WpBRNd6OHj7TLofhGNcgD3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mTzhKG6iJu8y14nNlXhAx75Nc43NEDdkPErwfR6Fw7ZYfdJGJxQdy5gll5Ln9Vj+1mnc5BooRTB9AKPv4njokiw8VUcIub8p7MQ==; 24:MIEe41dPbGvq6sVYvuiB2o+Sr+j11buWA/J4zfslcQi/sqe8yQ9hUwD9YilMEspWVMDePE+dwyGV4lecpd+UIlfdGppZetryQutekqf6VB8=; 20:5mYo3ZeWi5l095v4AkoURd2URNBR+M9i1YgZ3GBOBtP5ffeH51NHu6evIP0CTGdf6E01u+tjcH9pZTdKrconog== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2015 11:31:55.1413 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL2PR03MB484 X-Topics: patch Cc: petri.savolainen@nokia.com, stuart.haslam@arm.com Subject: [lng-odp] [API NEXT PATCH v7 10/14] api: cpumask: add new API odp_cpumask_all_available() X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 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" X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: patch@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) smtp.mailfrom=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 From: Hongbo Zhang In some cases, odp_cpu_count() isn't enough to show all the available CPUs, so a new API odp_cpumask_all_available() is introduced, which returns all the worker and control CPUs. Signed-off-by: Hongbo Zhang --- include/odp/api/cpumask.h | 10 ++++++++++ platform/linux-generic/odp_cpumask_task.c | 11 +++++++++++ 2 files changed, 21 insertions(+) diff --git a/include/odp/api/cpumask.h b/include/odp/api/cpumask.h index 4835a6c..97b851a 100644 --- a/include/odp/api/cpumask.h +++ b/include/odp/api/cpumask.h @@ -218,6 +218,16 @@ int odp_cpumask_default_worker(odp_cpumask_t *mask, int num); int odp_cpumask_default_control(odp_cpumask_t *mask, int num); /** + * Report all the available CPUs + * + * All the available CPUs include both worker CPUs and control CPUs + * + * @param[out] mask CPU mask to hold all available CPUs + * @return cpu number of all available CPUs + */ +int odp_cpumask_all_available(odp_cpumask_t *mask); + +/** * @} */ diff --git a/platform/linux-generic/odp_cpumask_task.c b/platform/linux-generic/odp_cpumask_task.c index 535891c..0c55545 100644 --- a/platform/linux-generic/odp_cpumask_task.c +++ b/platform/linux-generic/odp_cpumask_task.c @@ -50,3 +50,14 @@ int odp_cpumask_default_control(odp_cpumask_t *mask, int num ODP_UNUSED) odp_cpumask_set(mask, 0); return 1; } + +int odp_cpumask_all_available(odp_cpumask_t *mask) +{ + odp_cpumask_t mask_work, mask_ctrl; + + odp_cpumask_default_worker(&mask_work, 0); + odp_cpumask_default_control(&mask_ctrl, 0); + odp_cpumask_or(mask, &mask_work, &mask_ctrl); + + return odp_cpumask_count(mask); +}