Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1462imm; Fri, 21 Sep 2018 16:43:04 -0700 (PDT) X-Google-Smtp-Source: ACcGV62QONn47sIXO5O+U329Pj2U9QbiWAHkVBSLiJpqG0usBBiYi0jQdjyKbTN8V8QdQja6ZZH5 X-Received: by 2002:a63:fd52:: with SMTP id m18-v6mr36865pgj.304.1537573384727; Fri, 21 Sep 2018 16:43:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537573384; cv=none; d=google.com; s=arc-20160816; b=Ote/Tp3Ua5Xe27IHxAZ20P8UPacK58k4DIx3f2JPAqEAuJ+c2ufPFSWfkDo1eVhLnN 1NwKqYBwVsmCUu71oVWiaRIkoKeaH97/wAccpydOMw/hDA1LNI9kwnw5AXUMwpgwXWjO Y02ErzrLj7nd+4QUoNE7ki3KcV6PpdrRUM8XQc5+i5KEDh7KTaaVZ218OiqwTNFd2JW1 BNtKy8OpypfMBwMNh0Q1gFOh4BFGKfWuFyO+IlT2SCmjDRKIcbJrO7KB8CTtXKDACcoi FCGLRS0CvYOsf5cqvCA5pMpWwdrZ5m5okFprn7n3utLRnQJDw/Xec5+lLr8n2p7UYglu 1A7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=JmY1hpmOLffo2i7JsJA+iZLofuWfpaRDUhr4DQiWOaM=; b=bF9I4q+p9kyUtsy+oOwGBVKeHGDZjXrP6WILSLNDxlaa+gYxONTOJ+/khaUci7lrTz e7LuN5RZe6QiLeO6G8NDvGHu5aazyEwpOkc29Re4A+flHEXY1lF+ovXRMMU//iuEkKQv q/jAxCQ3xCm4Awexl/otRBLcv+ggx+2ak2QehKraEuLhwiydorhWpB53h4V3WinxU+mi Tbbmn6BG//qgO3CuePfBf2Pdfb7xM8ObDnaomcs/gHE3zCIEoSyTFZ8wwn/ZwKjsJdcy PwN7E8cECz2+jji+o4/nkuS+XfIHREUKNLk7fW4KlAJGPO6TEzpYNDRgvT4Jfp0K2g0D hUrA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s6-v6si115684pgg.41.2018.09.21.16.42.48; Fri, 21 Sep 2018 16:43:04 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391675AbeIVFdV (ORCPT + 99 others); Sat, 22 Sep 2018 01:33:21 -0400 Received: from mailout.easymail.ca ([64.68.200.34]:50916 "EHLO mailout.easymail.ca" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725756AbeIVFdU (ORCPT ); Sat, 22 Sep 2018 01:33:20 -0400 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 8E260C1410; Fri, 21 Sep 2018 23:42:10 +0000 (UTC) Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo01-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id RIIJrZjONBxm; Fri, 21 Sep 2018 23:42:10 +0000 (UTC) Received: from [192.168.1.87] (c-24-9-64-241.hsd1.co.comcast.net [24.9.64.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id BC859C05EF; Fri, 21 Sep 2018 23:42:01 +0000 (UTC) Subject: Re: [PATCH] selftests: watchdog: Add gettimeout and get|set pretimeout To: Jerry Hoemann , erosca@de.adit-jv.com Cc: linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Shuah Khan References: <1537570526-65241-1-git-send-email-jerry.hoemann@hpe.com> From: Shuah Khan Message-ID: <0c6376ec-a3f4-7798-8f30-829480c41f79@kernel.org> Date: Fri, 21 Sep 2018 17:42:00 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <1537570526-65241-1-git-send-email-jerry.hoemann@hpe.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jerry, Thanks for the patch. A few comments below: On 09/21/2018 04:55 PM, Jerry Hoemann wrote: > Add command line arguments to call ioctl WDIOC_GETTIMEOUT, > WDIOC_GETPRETIMEOUT and WDIOC_SETPRETIMEOUT. > > Signed-off-by: Jerry Hoemann > --- > tools/testing/selftests/watchdog/watchdog-test.c | 30 +++++++++++++++++++++++- > 1 file changed, 29 insertions(+), 1 deletion(-) > > diff --git a/tools/testing/selftests/watchdog/watchdog-test.c b/tools/testing/selftests/watchdog/watchdog-test.c > index 6e29087..4861e2c 100644 > --- a/tools/testing/selftests/watchdog/watchdog-test.c > +++ b/tools/testing/selftests/watchdog/watchdog-test.c > @@ -19,7 +19,7 @@ > > int fd; > const char v = 'V'; > -static const char sopts[] = "bdehp:t:"; > +static const char sopts[] = "bdehp:t:Tn:N"; > static const struct option lopts[] = { > {"bootstatus", no_argument, NULL, 'b'}, > {"disable", no_argument, NULL, 'd'}, > @@ -27,6 +27,9 @@ > {"help", no_argument, NULL, 'h'}, > {"pingrate", required_argument, NULL, 'p'}, > {"timeout", required_argument, NULL, 't'}, > + {"gettimeout", no_argument, NULL, 'T'}, > + {"pretimeout", required_argument, NULL, 'n'}, > + {"getpretimeout", no_argument, NULL, 'N'}, > {NULL, no_argument, NULL, 0x0} > }; > > @@ -71,6 +74,9 @@ static void usage(char *progname) > printf(" -h, --help Print the help message\n"); > printf(" -p, --pingrate=P Set ping rate to P seconds (default %d)\n", DEFAULT_PING_RATE); > printf(" -t, --timeout=T Set timeout to T seconds\n"); > + printf(" -T, --gettimeout Get the timeout\n"); > + printf(" -n, --pretimeout Set the pretimeout to T seconds\n"); > + printf(" -N, --getpretimeout Get the pretimeout\n"); How are the new arguments used? > printf("\n"); > printf("Parameters are parsed left-to-right in real-time.\n"); > printf("Example: %s -d -t 10 -p 5 -e\n", progname); Please add an example usage for each of these new arguments. > @@ -135,6 +141,28 @@ int main(int argc, char *argv[]) > else > printf("WDIOC_SETTIMEOUT errno '%s'\n", strerror(errno)); > break; > + case 'T': > + ret = ioctl(fd, WDIOC_GETTIMEOUT, &flags); > + if (!ret) > + printf("Watchdog timeout set to %u seconds.\n", flags); It would good to make this message different from the WDIOC_SETTIMEOUT message. Please update it to reflect that this is the result of a WDIOC_GETTIMEOUT. What would user intend to do with this GETTIMEOUT? Shouldn't this be the case that it prints the current value and exits instead of the same logic as SETTIMEOUT option? > + else > + printf("WDIOC_GETTIMEOUT errno '%s'\n", strerror(errno)) Shouldn't this error be an exit condition? > + break; > + case 'n': > + flags = strtoul(optarg, NULL, 0); > + ret = ioctl(fd, WDIOC_SETPRETIMEOUT, &flags); > + if (!ret) > + printf("Watchdog pretimeout set to %u seconds.\n", flags); > + else > + printf("WDIOC_SETPRETIMEOUT errno '%s'\n", strerror(errno)); > + break; > + case 'N': > + ret = ioctl(fd, WDIOC_GETPRETIMEOUT, &flags); > + if (!ret) > + printf("Watchdog pretimeout set to %u seconds.\n", flags); It would good to make this message different from the WDIOC_GETPRETIMEOUT message. Please update it to reflect that this is the result of a WDIOC_GETPRETIMEOUT What would user intend to do with this GETTIMEOUT? Shouldn't this be the case that it prints the current value and exits instead of the same logic as WDIOC_SETPRETIMEOUT? > + else > + printf("WDIOC_GETPRETIMEOUT errno '%s'\n", strerror(errno)); Shouldn't this error be an exit condition? > + break; > default: > usage(argv[0]); > goto end; > Also can you run this test as normal user? thanks, -- Shuah