Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752319AbdIVOlk (ORCPT ); Fri, 22 Sep 2017 10:41:40 -0400 Received: from ec2-52-27-115-49.us-west-2.compute.amazonaws.com ([52.27.115.49]:43239 "EHLO osg.samsung.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751898AbdIVOlj (ORCPT ); Fri, 22 Sep 2017 10:41:39 -0400 Subject: Re: [PATCH] selftests: timers: set-timer-lat: Fix hang when testing unsupported alarms To: john.stultz@linaro.org, tglx@linutronix.de, sboyd@codeaurora.org, ghackmann@google.com, shuah@kernel.org Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, Shuah Khan , Shuah Khan References: <20170921194510.16305-1-shuahkh@osg.samsung.com> From: Shuah Khan Message-ID: <8378e236-a46d-835d-639f-87963158695f@osg.samsung.com> Date: Fri, 22 Sep 2017 08:41:30 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170921194510.16305-1-shuahkh@osg.samsung.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1435 Lines: 39 Hi John/Greg, On 09/21/2017 01:45 PM, Shuah Khan wrote: > When timer_create() fails on a bootime or realtime clock, setup_timer() > returns 0 as if timer has been set. Callers wait forever for the timer > to expire. > > This hang is seen on a system that doesn't have support for: > > CLOCK_REALTIME_ALARM ABSTIME missing CAP_WAKE_ALARM? : [UNSUPPORTED] > > Test hangs waiting for a timer that hasn't been set to expire. > > Signed-off-by: Shuah Khan > --- > tools/testing/selftests/timers/set-timer-lat.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/timers/set-timer-lat.c b/tools/testing/selftests/timers/set-timer-lat.c > index 9c92b7bd5641..ab2fe225e051 100644 > --- a/tools/testing/selftests/timers/set-timer-lat.c > +++ b/tools/testing/selftests/timers/set-timer-lat.c > @@ -143,7 +143,8 @@ int setup_timer(int clock_id, int flags, int interval, timer_t *tm1) > printf("%-22s %s missing CAP_WAKE_ALARM? : [UNSUPPORTED]\n", > clockstring(clock_id), > flags ? "ABSTIME":"RELTIME"); > - return 0; > + /* Indicate timer isn't set, so caller doesn't wait */ > + return 1; > } > printf("%s - timer_create() failed\n", clockstring(clock_id)); > return -1; > I assume you are good with this fix. I plan to apply it to linux-kselftest fixes today. Please let me know if you have any objections. thanks, -- Shuah