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 5820643209; Thu, 26 Oct 2023 17:54:25 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 49B1E40EE2; Thu, 26 Oct 2023 17:54:25 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 47A40402D8 for ; Thu, 26 Oct 2023 17:54:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698335661; x=1729871661; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=ovTZrNUXr/Wb1esvYWudvqY1HSGemDcHFJZlCx8B5Ks=; b=A5/9kP/1tqFnfeI2A+fn0pbd75bC2mAfd+GKCAwjG+2dwDyIfnTgoVvn KZqHaoBimK+1PiIBAJPqQNWwnGBPmCxIu6oDQQFPzOndTXBk3+OS8Kbm6 6AI6ISPQfhCsL3NHNwCPS7NDJt5WW7H7jB0bw7v5Hkr1HgPsNdWTRu92S s23Vigi46dBFrbIgFYX3z8wJwEoj9lPCirSqyvulygzKxiocqLCOJENmy CZKTP1ZIyhx34IXmoXDJUKkaTckESmKGXxnYsssQrBd5BXQ3ETOfLaZTv HIoxYVPg0hgoVeZjiiEah68o92dUF1vwYdmvIqmIdAdbl35X+Rjthbsjj g==; X-IronPort-AV: E=McAfee;i="6600,9927,10875"; a="473824742" X-IronPort-AV: E=Sophos;i="6.03,253,1694761200"; d="scan'208";a="473824742" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Oct 2023 08:54:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.03,253,1694761200"; d="scan'208";a="7324028" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmviesa001.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 26 Oct 2023 08:54:01 -0700 Received: from fmsmsx611.amr.corp.intel.com (10.18.126.91) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 26 Oct 2023 08:54:11 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx611.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 26 Oct 2023 08:54:11 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34 via Frontend Transport; Thu, 26 Oct 2023 08:54:11 -0700 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (104.47.66.41) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.34; Thu, 26 Oct 2023 08:54:10 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IeFYYYHhJQG60bC4ARZ5pH09plRkE3UtRC9/QxMFlXccS1fSM7FDHZn3fP8Ala4d8hYIkQ78vWIetQJ2ugAgPMtIAR1xd0s8dlAuOWhAqKLH6Te0PB7Sk8yNV1FKMvhjwQ7PE9Ttj1ErhROx/up67GJzIhtFfismtseEUekMNZug4v/MLFJj0j1U8XjWRMNfqUvvdz30ILcWAltuhmR9W+h9/4Aq8f4RN5txpdmRGxWiEGSQzCVmRjc8AmhpbNW29EQ3AXnOyQJYZGasls+Vl9zNT5OFdR8gQ+sjzbKZS0SQ8IIFD6BfNV/QPiIAz4koY3PLziIFj//zvciVJlRs9A== 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=4EkOg2m8PK5ctmrPoqrKX9tX8HzFob0jaxFm7ZcB4h4=; b=kUsVCRbYwcfXcmCh89n/hJwa3XRlQZnSKoMtHqIZP45eHC+yrUEzoPFoCpecjSIMu+bGiVeu954k77TEcmOmLD7oSu8zhDKjXR+I8Co7nmPn6we6vYtFAK3Nyxl6elBR4s7eMXnTAAPmjJLSWanr+oRvYYenox3To723CBvU+iVa5u83cqR1ad+8mQ3wYgkp6yQIm/Nvo6LW2QKbd/hFcdYf/zWlVjt3yF71RAU3ohC1ZjQURXrg+ehdOAi9R+8YQyqlK63InsZDr2Tx7kB2vfgPBE+rokXrkV03nsCNePhTcCC8QGwLRTB+m2xfiofVKemSupc6xIcCW+zdZq2SUQ== 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 DS0PR11MB8206.namprd11.prod.outlook.com (2603:10b6:8:166::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.33; Thu, 26 Oct 2023 15:54:08 +0000 Received: from DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::d70b:11a0:d28f:ec44]) by DS0PR11MB7309.namprd11.prod.outlook.com ([fe80::d70b:11a0:d28f:ec44%6]) with mapi id 15.20.6907.032; Thu, 26 Oct 2023 15:54:08 +0000 Date: Thu, 26 Oct 2023 16:54:04 +0100 From: Bruce Richardson To: Morten =?iso-8859-1?Q?Br=F8rup?= CC: Thomas Monjalon , David Marchand , , Subject: Re: [PATCH v3 0/2] allow creating thread with real-time priority Message-ID: References: <20231024125416.798897-1-thomas@monjalon.net> <2434867.jE0xQCEvom@thomas> <98CBD80474FA8B44BF855DF32C47DC35E9EF9B@smartserver.smartshare.dk> <5410427.Sb9uPGUboI@thomas> <98CBD80474FA8B44BF855DF32C47DC35E9EF9C@smartserver.smartshare.dk> <98CBD80474FA8B44BF855DF32C47DC35E9EF9D@smartserver.smartshare.dk> Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9EF9D@smartserver.smartshare.dk> X-ClientProxiedBy: DUZPR01CA0271.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b9::27) To DS0PR11MB7309.namprd11.prod.outlook.com (2603:10b6:8:13e::17) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR11MB7309:EE_|DS0PR11MB8206:EE_ X-MS-Office365-Filtering-Correlation-Id: 0500403c-e298-45df-8db5-08dbd63bc9e0 X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4Q6GHKwtlbTHCAKIrdpJjhYZnsxvAQpMPM1RPjB84B96KCuWWz6fLtva9nmV2Hi0uZ1QPrTCCa+QZTMhXO/2ECqqBdgPsQTAdp6lk7z9GrB5q0+E3wJslzjr467R9vb3c947pZI2T0Ee8kRJIXLjrmbtTBvUMLb2UmPM3O4vEBQ/R8BN0tm1h66s1WShlxwPVSMtrysSRVra0vZbo84KL5nDEW7v9Beh3QsPEfpEGSj17fyf4G+G3Cs9KkpselZW5cCIyXFjrF5UEX+qq2OS0PVcHZGILX7z+s9KKHAZxwVPNqWf4jbb334BmOIEPzz28+UqaJExLJmIfkHoMyn8uxBXmPfcoHl06lFm+x9xh51K8FmI8qezNcQLeASX25TvchDpPZTC+GoXMzqDKQXynfZcEjFworEOeFMjXVqN9gBQaA1R42FUJp6OpIxxwQa/qJtPDbjx0Z2CGb8r7YqIettF43K8aFLeYTpRXA8dm5NFef8iZ/GyVYBKkv2dyeHSKtMpUhG3wAqecdYq3LkalmXdnrgD+YXX7i+UbtbbuODrLwY5/ppUyi9axoeO3yBg 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:(13230031)(39860400002)(346002)(136003)(376002)(396003)(366004)(230922051799003)(186009)(1800799009)(451199024)(64100799003)(44832011)(8936002)(8676002)(6486002)(4326008)(41300700001)(478600001)(66946007)(2906002)(316002)(86362001)(66556008)(6916009)(54906003)(66476007)(5660300002)(6512007)(6666004)(66574015)(82960400001)(38100700002)(6506007)(26005)(83380400001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?9zv9qX8Zo1KT9Hxct6b66tXH6iujujRj35L9ep4VFgsfPkn8ngtubUhHDt?= =?iso-8859-1?Q?igDj3a0fRVgrs0JKwWT078b3URoRblvd8MRsoQOS0XTQDQR1h+v1hu9G8l?= =?iso-8859-1?Q?i+zybIABQcTSeQJuzYeokAf0fYV9hJjLiwOgN8JQl3bp/KJO+0K4+sOJxH?= =?iso-8859-1?Q?FkFzfgmaknMZ/dozG+mcTYJw0CtOdTBfpQZe0GbQ32n7t2CDxgcXESZnNh?= =?iso-8859-1?Q?uM6Rb5B8oFerpKE/zymyD8WRwdbf5LeIleXv5mZLA3sMQ+hi5shejUNzOb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0U+n8qwf14x990gN3a/FrsI8dM4kv0?= =?iso-8859-1?Q?RnJBh1ok6aCTkiowGmy/ROzhNdGxjviCy3O4Zft95oYBvWSCUhe2iNeadF?= =?iso-8859-1?Q?ete8BRqQWB34qzyTdgb8oh5HNBdFCFQjkITIHFa9IrV5xQcHwE46IhrBPa?= =?iso-8859-1?Q?80jZ1siXs7QmaXOZat8PlLSWVT+0MpB0UCOx/VzxcBwzqBc4wXzQ5GX4Jn?= =?iso-8859-1?Q?WXMjDME8xqz3DKCsK+2Wc9P25xHPS+q9AcsdorY29RzM78mA/b8xOUq/WQ?= =?iso-8859-1?Q?9rx1E+P5MsdnJ81EKwIZ+/laBJxNLTmKOyt+CUPDMo7kztly4hlaUtkwjP?= =?iso-8859-1?Q?vodY7cow6ekr432bxa8dC5uuoluGy5cEK900xSjb5oSn5zOF6aM2dmv8xn?= =?iso-8859-1?Q?5fp/gmQZtd4nqm8uA3MCuo1E2oHSuAMB8u6CMgpFD9PmzmyOjs8KYi/v+n?= =?iso-8859-1?Q?7LcvFmHx2SYpj3iCCL1fj5Ggt3dU59G+Ith+0GZ6ySvXkP+C9aTKfGWg?= =?iso-8859-1?Q?=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 0500403c-e298-45df-8db5-08dbd63bc9e0 X-MS-Exchange-CrossTenant-AuthSource: DS0PR11MB7309.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2023 15:54:08.3640 (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: tsr+FrGFlyIejrETINVETtr1Vsk7nA3rC04iZ1HPQZdd5O2zOTyFqEipUMCOQ4A8Xd/x+DT6q5/seZtpqYNhRsdATrcJjFA41ZAl34ifF4U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR11MB8206 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 Thu, Oct 26, 2023 at 04:59:51PM +0200, Morten Brørup wrote: > > From: Morten Brørup [mailto:mb@smartsharesystems.com] > > Sent: Thursday, 26 October 2023 16.50 > > > > > From: Thomas Monjalon [mailto:thomas@monjalon.net] > > > Sent: Thursday, 26 October 2023 16.31 > > > > > > 26/10/2023 16:08, Morten Brørup: > > > > > From: Thomas Monjalon [mailto:thomas@monjalon.net] > > > > > Sent: Thursday, 26 October 2023 16.05 > > > > > > > > > > 26/10/2023 15:57, Morten Brørup: > > > > > > > From: Morten Brørup [mailto:mb@smartsharesystems.com] > > > > > > > Sent: Thursday, 26 October 2023 15.45 > > > > > > > > > > > > > > > From: Thomas Monjalon [mailto:thomas@monjalon.net] > > > > > > > > Sent: Thursday, 26 October 2023 15.37 > > > > > > > > > > > > > > > > 25/10/2023 18:31, Thomas Monjalon: > > > > > > > > > Real-time thread priority was been forbidden on Unix > > > > > > > > > because of problems they can cause. > > > > > > > > > Warnings and helpers are added to avoid deadlocks, > > > > > > > > > so real-time can be allowed on all systems. > > > > > > > > > > > > > > > > Unit test is failing: > > > > > > > > DPDK:fast-tests / threads_autotest TIMEOUT 600.01 s > > > > > > > > > > > > > > > > It is seen in only 1 target (maybe the failure occurence is > > random): > > > > > > > > Debian 11 (Buster) (ARM) | PASS > > > > > > > > Fedora 37 (ARM) | PASS > > > > > > > > CentOS Stream 9 (ARM) | FAIL > > > > > > > > Fedora 38 (ARM) | PASS > > > > > > > > Fedora 38 (ARM Clang) | PASS > > > > > > > > Ubuntu 20.04 (ARM) | PASS > > > > > > > > > > > > > > > > I need to send a v4 with new implementation and better comments. > > > > > > > > The Unix sleep will be upgraded from 1 ns to 1 us in case it makes > > a > > > > > > > > difference. > > > > > > > > > > > > > > It will not make a difference. The kernel will go through the > > sleeping > > > > > steps, > > > > > > > then wake up again and see the real-time thread is ready to run, and > > > then > > > > > > > immediately schedule it. > > > > > > > > > > > > > > For testing purposes, consider sleeping 10 milliseconds or something > > > > > > > significant like that. > > > > > > > > > > > > A bit more details... > > > > > > > > > > > > In our recent tests, nanosleep() itself took around 50 us. So you need > > > to > > > > > sleep longer than that for your thread not to be runnable when the > > > nanosleep() > > > > > wakes up again, because 50 us has already passed in "nanosleep > > overhead". > > > > > > 10 milliseconds provides plenty of margin, and corresponds to 10 > > jiffies > > > on > > > > > a 1000 Hz kernel. (I don't know if it makes any difference for the > > kernel > > > > > scheduler if the timer crosses a jiffy border or not.) > > > > > > > > > > 10 ms looks like an eternity. > > > > > > > > Agree. It is only for functional testing, not for production! > > > > > > Realtime thread won't make any sense if we have to insert a long sleep. > > > > It seems David came to our rescue here! > > > > I have just tried running our test again with prctl(PR_SET_TIMERSLACK) of 1 > > ns, and the nanosleep(1 ns) delay dropped from ca. 50 us to ca. 2.5 us. > > > > The timeout parameter to epoll_wait() is in milliseconds, which is useless for > > low-latency. > > Perhaps real-time threads can be used with epoll() combined with timerfd for > > nanosecond resolution timeout. > > Or epoll_pwait2(), which has nanosecond resolution timeout. > > Unfortunately, rte_epoll_wait() is not an experimental API anymore, so we cannot change its timeout parameter from milliseconds to micro- or nanoseconds. We would have to introduce a new API for this. > Just an idea - can we change the timeout parameter to float rather than int, and then use function versioning for backward compatibility for any binaries passing int? That way the actual meaning of the parameter doesn't change, but it still allows sub-millisecond values (all-be-it with some loss of accuracy due to float). /Bruce