From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id 7F6E45B1E for ; Fri, 2 Nov 2018 15:35:42 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Nov 2018 07:35:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,456,1534834800"; d="scan'208";a="105411789" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga002.jf.intel.com with ESMTP; 02 Nov 2018 07:35:41 -0700 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Fri, 2 Nov 2018 07:35:41 -0700 Received: from fmsmsx117.amr.corp.intel.com ([169.254.3.70]) by FMSMSX112.amr.corp.intel.com ([169.254.5.114]) with mapi id 14.03.0415.000; Fri, 2 Nov 2018 07:35:40 -0700 From: "Wiles, Keith" To: "Burakov, Anatoly" CC: Somnath Kotur , dev Thread-Topic: [dpdk-dev] Question about rte_manage_timer() and eal_intr_handle_interrupts Thread-Index: AQHUcp+vLPkdAaFE0UyZz2xonkUmRqU9AsAA Date: Fri, 2 Nov 2018 14:35:40 +0000 Message-ID: <3B45A79A-D782-4274-984C-DB1CD49B7252@intel.com> References: <051139db-381e-5f2f-32dc-1b91e8e45fee@intel.com> In-Reply-To: <051139db-381e-5f2f-32dc-1b91e8e45fee@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.255.78.211] Content-Type: text/plain; charset="us-ascii" Content-ID: <4A395128C9E233428F257BE95CF7EAD3@intel.com> Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] Question about rte_manage_timer() and eal_intr_handle_interrupts X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Nov 2018 14:35:43 -0000 > On Nov 2, 2018, at 6:31 AM, Burakov, Anatoly = wrote: >=20 > On 02-Nov-18 4:00 AM, Somnath Kotur wrote: >> Hello, >> I'm trying to launch a thread - lcore_mainloop( from >> examples/timer/main.c ) that runs rte_manage_timer() every 2s from testp= md >> to ensure the timers i've registered in my driver are checked for expiry= ( >> i even tried putting this thread in my driver as well, no difference i= n >> results) and i see that while this thread is running, i somehow seem to >> stop getting interrupts ..infact i don't even >> see eal_intr_process_interrupts () being called. >> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c >> index ca4e1a4..a8d71d6 100644 >> --- a/app/test-pmd/testpmd.c >> +++ b/app/test-pmd/testpmd.c >> @@ -71,6 +71,8 @@ >> #include >> #include >> #include >> +#include >> +#include >> #include >> #include >> #ifdef RTE_LIBRTE_IXGBE_PMD >> @@ -2524,6 +2526,30 @@ signal_handler(int signum) >> } >> } >> +static int >> +lcore_mainloop(__attribute__((unused)) void *arg) >> +{ >> + uint64_t prev_tsc =3D 0, cur_tsc, diff_tsc; >> + unsigned int lcore_id; >> + >> + lcore_id =3D rte_lcore_id(); >> + printf("Starting mainloop on core %u\n", lcore_id); >> + >> + while (f_quit =3D=3D 0) { >> + cur_tsc =3D rte_rdtsc(); >> + diff_tsc =3D cur_tsc - prev_tsc; >> + /* Schedule every 2 seconds */ >> + if (diff_tsc > rte_get_timer_hz() * 2) { >> + rte_timer_manage(); >> + prev_tsc =3D cur_tsc; >> + } else >> + sleep(1); >> + } >> + return 0; >> +} >> + >> int >> main(int argc, char** argv) >> { >> @@ -2627,6 +2653,7 @@ main(int argc, char** argv) >> if (strlen(cmdline_filename) !=3D 0) >> cmdline_read_from_file(cmdline_filename); >> + rte_eal_remote_launch(lcore_mainloop, NULL, 3); >> if (interactive =3D=3D 1) { >> if (auto_start) { >> printf("Start automatic packet forwarding\n"); >> My testpmd cmdline is like so: >> testpmd -c 0xff -n 3 -- -i portmask=3D0x3 --nb-cores=3D3 --rxq=3D1 --txq= =3D1 >> Any idea what could be the problem ? Is this something that is expected = or >> am i doing something wrong ? >> Thanks >> Som >=20 > I may be completely off mark here, but as far as i understand, the EAL Al= arm API uses the interrupt thread. The rte_timer API is a high performance = timer API and is meant to be managed manually, by periodically[1] calling r= te_timer_manage(). If you want something to be called every two seconds, ju= st set up an rte_alarm - there's no need to use the timer API (unless you a= re on FreeBSD, where alarm API is not officially supported). >=20 > [1] as in, more frequently than every two seconds if you want to have any= semblance of timer precision! >=20 Unless we changed it I believe the=20 > --=20 > Thanks, > Anatoly Regards, Keith