From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 06FA41B3FB for ; Fri, 2 Nov 2018 12:31:49 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Nov 2018 04:31:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,455,1534834800"; d="scan'208";a="97125067" Received: from aburakov-mobl1.ger.corp.intel.com (HELO [10.252.4.47]) ([10.252.4.47]) by orsmga003.jf.intel.com with ESMTP; 02 Nov 2018 04:31:47 -0700 To: Somnath Kotur , dev References: From: "Burakov, Anatoly" Message-ID: <051139db-381e-5f2f-32dc-1b91e8e45fee@intel.com> Date: Fri, 2 Nov 2018 11:31:47 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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 11:31:50 -0000 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 testpmd > 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 in > 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 = 0, cur_tsc, diff_tsc; > + unsigned int lcore_id; > + > + lcore_id = rte_lcore_id(); > + printf("Starting mainloop on core %u\n", lcore_id); > + > + while (f_quit == 0) { > + cur_tsc = rte_rdtsc(); > + diff_tsc = cur_tsc - prev_tsc; > + /* Schedule every 2 seconds */ > + if (diff_tsc > rte_get_timer_hz() * 2) { > + rte_timer_manage(); > + prev_tsc = 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) != 0) > cmdline_read_from_file(cmdline_filename); > > + rte_eal_remote_launch(lcore_mainloop, NULL, 3); > if (interactive == 1) { > if (auto_start) { > printf("Start automatic packet forwarding\n"); > > > My testpmd cmdline is like so: > > testpmd -c 0xff -n 3 -- -i portmask=0x3 --nb-cores=3 --rxq=1 --txq=1 > > Any idea what could be the problem ? Is this something that is expected or > am i doing something wrong ? > > Thanks > Som > I may be completely off mark here, but as far as i understand, the EAL Alarm 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 rte_timer_manage(). If you want something to be called every two seconds, just set up an rte_alarm - there's no need to use the timer API (unless you are on FreeBSD, where alarm API is not officially supported). [1] as in, more frequently than every two seconds if you want to have any semblance of timer precision! -- Thanks, Anatoly