From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id BD7B2423AC; Wed, 11 Jan 2023 11:10:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6801A40691; Wed, 11 Jan 2023 11:10:42 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id E30C34014F for ; Wed, 11 Jan 2023 11:10:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673431841; x=1704967841; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=HY6rvzMfRxth29q4//RqfzqSVlJPlmTbQTYwNevyMwA=; b=hbDuv91P1j3UbgsuhXHYFBFjqldyGBnK873AEX9phTaJGPyijge9QavA 9Qabo9OHdLA+LAyvK3DmLlScPT1uYrS9sX4jfWfWCa2MtL8dGGHgZneQP iGJYZDK/c/hCl4ftDShUGdGPeIdy2u9oxLx6IibQPgH7jW4z7KsEPDbLl 4FBsB4qejSErLzcFtdMJgnjMv38Ue4svcZButO26rsHVxzk+yBPEmstED HZm6AAsqaRYDdXlSXa03kgKRx22kD1zmNTzbFOl2L1KyRMNsrUSrAYRrX ZtJRO95fVU85uhD3i9NBaroeGy87mE0lIOr/znAEHuqMenf5RRMfEgqBb g==; X-IronPort-AV: E=McAfee;i="6500,9779,10586"; a="306896204" X-IronPort-AV: E=Sophos;i="5.96,315,1665471600"; d="scan'208";a="306896204" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jan 2023 02:10:37 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10586"; a="799779742" X-IronPort-AV: E=Sophos;i="5.96,315,1665471600"; d="scan'208";a="799779742" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by fmsmga001.fm.intel.com with ESMTP; 11 Jan 2023 02:10:36 -0800 Received: from orsmsx611.amr.corp.intel.com (10.22.229.24) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Wed, 11 Jan 2023 02:10:36 -0800 Received: from orsmsx603.amr.corp.intel.com (10.22.229.16) by ORSMSX611.amr.corp.intel.com (10.22.229.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Wed, 11 Jan 2023 02:10:35 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Wed, 11 Jan 2023 02:10:35 -0800 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.109) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Wed, 11 Jan 2023 02:10:35 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NNwhGqKeVxnBUODqw0mnLcHeUg8mag94bs2LTDcVIqvVfNpa/rCWMmaqiNkBgmUoVqI32hp3mLwTCluTTF1o17inm7BHS+jaMg6zFJSoTHN9YVoYEY7hdojP/zYb0yg4IIhJzfwE6FE45cZmD0qYBbwwmRflNUp0iDtL+bwv83zh83FhuZwwL72nMzKrH39mhNPa9Q2r9eN2216gbbEnhba2XbIeaAAMGu1jHiuU7+X2Y9hZfIv4SP6eaqZWnHGzFgGqLJN8QHVdrkVO3YeTyOC1fFhRZTR6PqsUxbCfQyAhhERnUEjVQHeByf8DGRtCAT18xw8FUQ/tgwoI+JWMng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TBZg0W1hVTJcVB3qq4hVea9uXmS1IiMRMmlPnc3Sca0=; b=KIQ7Oqfkq9YpQEFzx+r66htmMtdxAset1fOsM7xfBHUUEZ1ny+y3YSBjvjmeeL8ejeRO/a3ER6ciGqmGF58aMnj6KbFDweIQIIwcI4kp3ss8oPtdnHs1kPgCG7cLp0Sq6WIkF+PahIQZGbK/a/YD8l9yaxIwmQcbU5fjJ8JqwdGtm9+4qOtjQjxHLlIzyE1AZYBeG0ymocxbAmByFcyV9NR7WPL09eqg9w5KBzydftF7TiHPYnyZbzSQ5bh8SdkKZ+fPhmA2frJk/N4H8xYSgZapDVdxNxoqsyWoETsARpsoDlqRNq0bo8VVI20ekgWjcOnfSOH6ev2L/mIphjyzUw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) by SJ2PR11MB7474.namprd11.prod.outlook.com (2603:10b6:a03:4ca::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5986.18; Wed, 11 Jan 2023 10:10:33 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::4d9f:6867:2d53:9ee]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::4d9f:6867:2d53:9ee%8]) with mapi id 15.20.5986.018; Wed, 11 Jan 2023 10:10:33 +0000 Date: Wed, 11 Jan 2023 10:10:27 +0000 From: Bruce Richardson To: Tyler Retzlaff CC: Subject: Re: RFC abstracting atomics Message-ID: References: <20230109225604.GA25566@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> <20230110201033.GC21476@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20230110201033.GC21476@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> X-ClientProxiedBy: LO4P123CA0292.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:196::9) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|SJ2PR11MB7474:EE_ X-MS-Office365-Filtering-Correlation-Id: f93babd4-5d20-4d02-9bd9-08daf3bc1336 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wS75+0zJRv1nzl/Y7rzcGwUnAhQQm1amB9erS6JW4H3rVeT3tmypHaE5Ql2rq0LnZDqaUTDKx9rgDhcWUl3EI7n45YU2y/H5rBmLRnXw1wXxuB0W4YJE4UDOmuxFl+Nit2MGxqVybRZOk3kE+EMazGrEGpA73gq0hP3gbG5agJud7cRPVuhP0tQmfT4zi26tfcmemMe355yMnfqDrVdgMKnmcLAbLdepH/ImZe8bBxVypVF/VtaFxhr7NZv4emshr+k8TsBubVnxu5xJe0oWjXAutesQkSNTgylO6wQglAcIfzjSzvBa5pUZfE+eHU/A2xXSwLx29RO8MutXOvuMC6DyYnyUL4VcKa4vcE1XBm/QoqIKNUAYVSq66kStwOpyUYp4iS0lQ0sFbhouw8zySSzuZXZIlag6kMeKuFt6MSIxxtSaCk+ot3JU3nQ1QLHlW5LjEw/9S4e1Mxi3D91f+OS9KMnsetL577q2OavpmICxldUU8sqQXzBIfnvMc1hYycp2Znq5/p+rhHPYDrZKqViFxcHdVsWGqZlSqkYWEKC+PC3R1TdFzYwQVkwG/3NKYVlHueHuRUUQS5E+RZ4rHsJfr22KwUhjKaWaZw/4A2UkgrgHFGPsyvRf4O0XAyIkMmTBT+r3a69HaWVUBvU45g== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:DS0PR11MB7309.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(346002)(376002)(136003)(366004)(396003)(39860400002)(451199015)(41300700001)(38100700002)(66899015)(66476007)(66556008)(66946007)(8676002)(82960400001)(83380400001)(5660300002)(8936002)(7116003)(4326008)(6916009)(316002)(2906002)(86362001)(44832011)(6506007)(6486002)(6666004)(3480700007)(186003)(478600001)(26005)(6512007); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?gOO57uzbFAOGhi+0jPl4tReQEl5xz2uc7TCyAHML8JcFW0W0sdCMhlaY4oY3?= =?us-ascii?Q?/IT8ZS7Dcc3+uXnR5BDlBD1oPjx1odWbREfRzrfOSBvhKlcC2M9KYQ2IHOgO?= =?us-ascii?Q?FJgA/i95QOogni+FcHmCnYgVndo24Qy0tqWVJ5tOCyx9aiwpOW2LHgzRqo9s?= =?us-ascii?Q?KzFWOrUfTEnjKLE+BIUTXLkCfNK/iZHmFCdg590tq5niRyDVCeYK9fCQhDpc?= =?us-ascii?Q?rhKbWB8fC3In4Xsc2dYiQhnxe1fcEvSZ04VkfBtrMbjH6HB1JetN4fo5MBHM?= =?us-ascii?Q?Uq8MxzM7CrseXhLNhvdfj/jpNhQrXRpmZq7YwEjOniQWnl8OVrWjlxCEIzFZ?= =?us-ascii?Q?HTgTu0jCwNpxoF/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h9j8VE84IW9d?= =?us-ascii?Q?U2pE9fnK9LBAIkIgMKHbug4/65aRs4W/fHSui77byD0q3KSPoemBTRxaRNBP?= =?us-ascii?Q?o4tzJs5PP14jT6Zi8XnxBMaJNdQ90xfPzT+cM9rvyvEnwXA43BltXPXtFGM6?= =?us-ascii?Q?jnPYIy3wLYaX3QtXpzCE3P/BvpvSDGs/TOHlAOyC5wreZ84N1ByOrvbg7Vap?= =?us-ascii?Q?1b7oNZVArYzj0mRse84BehYKNykosjo9V+W94ECDpK8Eq0y8sAn5pE1Ad5im?= =?us-ascii?Q?pu5VP2YOw/KEb2CyygOsHS/lRPNDTEuPfG/o79yFJsTyUOQUJgqbqBYOUWbS?= =?us-ascii?Q?DrjvYSUUHKuiFDQ0vP7YtKjDQxJHtYMvcWOnPT8r0DON1+zZlnPeQUPweXxA?= =?us-ascii?Q?cA=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: f93babd4-5d20-4d02-9bd9-08daf3bc1336 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jan 2023 10:10:33.0281 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: i6cMzlY7k6fro8CJ7beujU4MilRDfINTWZ0p26DtrbckP7tf1LZFXL5JsePwuYetG1OCIuoIMKU7ESh06mQKJOw2EswwHnPD+0Ks3jEYDH4= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR11MB7474 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, Jan 10, 2023 at 12:10:33PM -0800, Tyler Retzlaff wrote: > On Tue, Jan 10, 2023 at 09:16:48AM +0000, Bruce Richardson wrote: > > On Mon, Jan 09, 2023 at 02:56:04PM -0800, Tyler Retzlaff wrote: > > > hi folks, > > > > > > i would like to introduce a layer of abstraction that would allow > > > optional use of standard C11 atomics when the platform / toolchain > > > combination has them available. > > > > > > making the option usable would be a phased approach intended to focus > > > review and minimize dealing with churn on such a broad change. > > > > > > 1. provide an initial series to add the abstraction and the ability > > > control enablement with a meson option enable_stdatomics=false will > > > be the default. > > > > > > for all existing platform / toolchain combinations the default would > > > remain false. i.e. i have no plans to enable it for existing platforms > > > toolchain combinations but leaves a change of default open to the > > > community as a future discussion if it is desired. > > > > > > 2. once the initial abstraction is integrated a series will be introduced to > > > port the tree to the abstraction with enable_stdatomics=false. the goal > > > being low or no change to the current use of gcc builtin C++11 memory > > > model atomics. > > > > > > 3. once the tree is ported a final series will be introduced to introduce > > > the remaining change to allow the use of enable_stdatomics=true. > > > > > > would appreciate any assistance / suggestions you can provide to > > > introduce the abstraction smoothly. > > > > > > > Plan generally sounds ok. However, beyond point #3, would there then be > > plans to remove the option and always use stdatomics in future? > > that is a discussion for the community i think on a per-platform / > per-toolchain basis. there is likely to be resistance which is why i'm > favoring the opt-in if you want model. > > some potential arguments against switching. > > * it's an abi break there is no way around it. > * old compiler x stdatomics implementation is less optimal than > old compiler x __atomics (potential argument). > * there's some "mixed" use of variables in the tree where sometimes we > operate on them as if they are atomic and sometimes not. the std > atomics apis doesn't support this sometimes atomic codegen you either > get atomic or you don't. > * direct use of atomics default to seq_cst ordering if the strengthening > of the ordering is not desired each variable needs to be hunted down > and explicitly returned to relaxed ordering access. > > > To slightly expand the scope of the discussion - would it be worthwhile > > putting these abstractions in a new library in DPDK other than EAL, to > > start the process of splitting out some of the lower-level material from > > that library? > > the abstraction as i have prototyped it is a set of conditionally > compiled macros where the macros mirror the standard c atomics for > naming and have been placed in include/generic/rte_atomics.h > > i've no problem splitting it out into a separate library and then have > EAL depend on it, but it is currently header only so i'm not sure if it > is worth doing for that. > > we can chew on that more in a couple days when i submit the base series > if you like. > Thanks. One additional point that just became clear to me when I started thinking about upping our DPDK C-standard-baseline. We need to be careful what we are considering when we up our C baseline. We can mandate a specific compiler minimum and C version for compiling up DPDK itself, but I think we should not mandate that for the end applications. That means that our header files, such as atomics, should not require C99 or C11 even if the build of DPDK itself does. More specifically, even if we bump DPDK minimum to C11, we should still allow apps to build using older compiler settings. Therefore, we probably need to maintain non-C11 atomics code paths in headers beyond the point at which DPDK itself uses C11 as a code baseline. /Bruce