From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1423557AbcFMSFl (ORCPT ); Mon, 13 Jun 2016 14:05:41 -0400 Received: from mga01.intel.com ([192.55.52.88]:47378 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030186AbcFMSFk (ORCPT ); Mon, 13 Jun 2016 14:05:40 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,467,1459839600"; d="scan'208";a="827193519" From: "Jiang, Dave" To: "Allen.Hubbe@emc.com" , "logang@deltatee.com" , "jdmason@kudzu.us" CC: "linux-kernel@vger.kernel.org" , "shuahkh@osg.samsung.com" , "sudipm.mukherjee@gmail.com" , "linux-kselftest@vger.kernel.org" , "arnd@arndb.de" , "linux-ntb@googlegroups.com" Subject: Re: [PATCH 1/8] ntb_perf: Schedule based on time not on performance Thread-Topic: [PATCH 1/8] ntb_perf: Schedule based on time not on performance Thread-Index: AQHRw2s289LeHTOuDE65aeh9pfm1EJ/oKsqA Date: Mon, 13 Jun 2016 18:05:34 +0000 Message-ID: <1465841117.16234.248.camel@intel.com> References: <03a622a20a667b17046fbd45bb952f8dbd235653.1465598632.git.logang@deltatee.com> In-Reply-To: <03a622a20a667b17046fbd45bb952f8dbd235653.1465598632.git.logang@deltatee.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [143.182.137.38] Content-Type: text/plain; charset="utf-8" Content-ID: <8CE0DA850D248746AE50349D078B5D1D@intel.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id u5DI5k9M009975 On Fri, 2016-06-10 at 16:54 -0600, Logan Gunthorpe wrote: > When debugging performance problems, if some issue causes the ntb > hardware to be significantly slower than expected, ntb_perf will > hang requiring a reboot because it only schedules once every 4GB. > > Instead, schedule based on jiffies so it will not hang the CPU if > the transfer is slow. > > Signed-off-by: Logan Gunthorpe Acked-by: Dave Jiang > --- >  drivers/ntb/test/ntb_perf.c | 6 ++++-- >  1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/drivers/ntb/test/ntb_perf.c > b/drivers/ntb/test/ntb_perf.c > index 4368519..5008ccf 100644 > --- a/drivers/ntb/test/ntb_perf.c > +++ b/drivers/ntb/test/ntb_perf.c > @@ -273,6 +273,7 @@ static int perf_move_data(struct pthr_ctx *pctx, > char __iomem *dst, char *src, >   char __iomem *tmp = dst; >   u64 perf, diff_us; >   ktime_t kstart, kstop, kdiff; > + unsigned long last_sleep = jiffies; >   >   chunks = div64_u64(win_size, buf_size); >   total_chunks = div64_u64(total, buf_size); > @@ -288,8 +289,9 @@ static int perf_move_data(struct pthr_ctx *pctx, > char __iomem *dst, char *src, >   } else >   tmp += buf_size; >   > - /* Probably should schedule every 4GB to prevent > soft hang. */ > - if (((copied % SZ_4G) == 0) && !use_dma) { > + /* Probably should schedule every 5s to prevent soft > hang. */ > + if (unlikely((jiffies - last_sleep) > 5 * HZ)) { > + last_sleep = jiffies; >   set_current_state(TASK_INTERRUPTIBLE); >   schedule_timeout(1); >   } > --  > 2.1.4 >