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 34D3241E16; Wed, 8 Mar 2023 03:51:12 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 125FB40ED6; Wed, 8 Mar 2023 03:51:12 +0100 (CET) Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by mails.dpdk.org (Postfix) with ESMTP id 3ECBC40E03 for ; Wed, 8 Mar 2023 03:51:10 +0100 (CET) Received: by mail-pl1-f182.google.com with SMTP id x11so11858010pln.12 for ; Tue, 07 Mar 2023 18:51:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; t=1678243869; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=a0d4E5kWuJbOW1qh95+101Js6d/gbNhllH/lSm77A/s=; b=2GHZoHJi4yaqN9OCbBPnhf6iKVWBnLcvlTxJYtA31J58vz7l98PLvPa3Ll8uCqWqUW iGvLY/sF/zu19R7GeXTYHFPeuB/fZKNHMw/1zl7AziVIalGTr3Pnmma2sls8WNTeU+dG qAnk5A0XnXGI/ctn/BKVN6c5fkYHxM44Cc5Z4qiP+FymH9cVKROFB0Muzh4DnoZd77u6 IUtm5oVcfTkQ4RRL9T6jc/u7DZPBoMzNK0HsTjz7KudH/6FT6UrSoE9+bKKognE0mvEI WkbGuEtWJT1GGR6AqN6ADfXoM11kuCdNPbd4gCMsb4Zj8bc3I32YalUEbXe/Togg8rmN iGYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678243869; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a0d4E5kWuJbOW1qh95+101Js6d/gbNhllH/lSm77A/s=; b=vcVocJ0SS1r24kcCYaK6RImN+HYaoDAi09w3POXcDT1gqaWpyxral1PKAsgSS3f7ZR E8osVQ7HwipG+DoULpIbIHFM4Ir/gPATTHIz7bHg6yaI4q27AT8UV2HRov7i3EGB3Avn F6pykoB4mF4rOPu+W/HV5HzMeil4Mtp0IByWbw+aazlCq0nqLVPEiVu/ot24f9BJXbh2 lKXSUxBo46ytcsW558rFva5F1F4lWcKY/lswOe4i3jot5pBn89wrT1QksZPfx42ifG7C 72jSiMQ4j7A7osuxVflfBU6iofDLpc4SYBnlss7hXgOKXU4GAhd/ez8rTt7C5IPU9StN K/9Q== X-Gm-Message-State: AO0yUKWJ7ll+lI53P6l/DW0w4ihaet9M+QGh5nWDXfxnIty2XhiyxmjO HUzrMMtjuCOcMzRjreoqblnpiA== X-Google-Smtp-Source: AK7set/JrFxYeJiA1ddQfta9+3WjRM9nK2hAjgfwWMv9QKbKBX9RecEpt4QmuijJ1ApQu0F+Rz7Aaw== X-Received: by 2002:a17:902:f685:b0:19c:e440:9256 with SMTP id l5-20020a170902f68500b0019ce4409256mr20353622plg.35.1678243869365; Tue, 07 Mar 2023 18:51:09 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id i8-20020a170902c94800b0019aa8149cb3sm8968895pla.219.2023.03.07.18.51.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Mar 2023 18:51:09 -0800 (PST) Date: Tue, 7 Mar 2023 18:51:07 -0800 From: Stephen Hemminger To: fengchengwen Cc: , Bruce Richardson Subject: Re: [PATCH v3 2/2] eal: add option to put timestamp on console output Message-ID: <20230307185107.05cee177@hermes.local> In-Reply-To: <2f046d72-355a-93a5-ede6-0f729e9e525b@huawei.com> References: <20200814173441.23086-1-stephen@networkplumber.org> <20230306192810.106154-1-stephen@networkplumber.org> <20230306192810.106154-3-stephen@networkplumber.org> <216dfffb-2a50-3288-27a5-5078ea9eb22d@huawei.com> <20230307080657.4b7be99e@hermes.local> <2f046d72-355a-93a5-ede6-0f729e9e525b@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 Wed, 8 Mar 2023 08:36:48 +0800 fengchengwen wrote: > > Never, never configure a DPDK application with real-time process priority. > > Polling model and RT don't mix. > > Maybe we should document them ? LOL - ChatGPT is amusing if you ask it. The answer is pro grammatically correct, but will not work. The caveat at the end is much bigger than it understands. Question: Is Dataplane Development Kit (DPDK) compatible with Linux Real Time thread priority like SCH_FIFO? Yes, Dataplane Development Kit (DPDK) is compatible with Linux Real-Time thread priority scheduling policies, such as SCHED_FIFO. Answer: DPDK supports setting the thread priority using the standard Linux pthread APIs, including pthread_setschedparam() and pthread_attr_setschedpolicy(). This allows the application to configure the thread scheduling policy and priority for DPDK worker threads. To set the real-time priority of DPDK threads, you can use the pthread_setschedparam() function to set the scheduling policy to SCHED_FIFO or SCHED_RR and the priority value to a value between 1 and 99. Here is an example of how to set the real-time priority of a DPDK thread: > pthread_t tid; > struct sched_param sched_param; > pthread_attr_t attr; > > pthread_attr_init(&attr); > pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); > > sched_param.sched_priority = 50; > pthread_attr_setschedparam(&attr, &sched_param); > pthread_attr_setschedpolicy(&attr, SCHED_FIFO); > > pthread_create(&tid, &attr, thread_func, arg); In this example, the SCHED_FIFO scheduling policy is used, and the priority value is set to 50. You can adjust the priority value according to your needs. Note that using real-time scheduling policies like SCHED_FIFO or SCHED_RR requires careful consideration of system resources and may impact system performance if not used properly. It is recommended to consult the Linux documentation and to test the system thoroughly before deploying any application using real-time scheduling policies.