Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp99227ybx; Wed, 30 Oct 2019 11:58:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9I8xB0WLW5F1YsYML+nU0UQW6c5yd+4NxTPFb1YExFqOG93t2+BZ9/djtK+rUJ6iWHzB9 X-Received: by 2002:a50:b5e3:: with SMTP id a90mr1307202ede.201.1572461890831; Wed, 30 Oct 2019 11:58:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572461890; cv=none; d=google.com; s=arc-20160816; b=0Zq1Wvqar2y70FnQVrjWYhHd7Tpl5JNm8WxfUhKb7xvK6BSZ/48UMM/q1MWMtE3g0h ZyP+2FQfxz/N6aQ3uwm5Zm3NgFKn7WBc0+Lo7nGpBZ1kplTy81AL1ghGGLloUz4RJ7bY lqsb33NGLX5sGVE7LGuoMJo7azSTEnz6N3EaDrgitoQAw/5rvzIxtLUglFsmiK2f9iTe Dl4jEUX041SZr88x7KFxYZhaaQxqee9zIJtYIg+fOnUj1P6rXFPWWF7xaP74Lq5ge/WY fO8gn9MGqIPBUzUCarIDoKxxWzhwsSmDhuuufugTdq6+9lGqiQJvYg4kle8fVgqzNZ6P /YTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=+uwntaunJvEfF6N2JBmOpTRxiy4nvBNTDpuqDzHj3b0=; b=nLY7fWRD/F7J4KKawCd1geUmBqK3fj1a3jw7/aDF3z+W9LMjjlHdR3d7/7KCVoEU47 A50A9vIIn/UHwh72lfQeQ5Fib1itgqYTT4fY1bUcr0Rd1cYnkc7S88cQDH5hqu4vAPnn BdILMdPEg+B2/jH0rVJgUZjdg+Vh7c4SVKWznB1NvFolOOyRIRAdoKRRQj5wOgW4CD9j tlSO7kWh51yTr6t+0IfXWsFKafQQ1SyN6ynPJwhktSyQB8g7MnW22yImNiWVARJ6zyyY 71836CReN54LWOvU9HgGC0TEv885C1nioLunbDfpFwqOBp2MZ7q64OgmzE5IiLbsDuOo 86Fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jb8vok3s; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q40si2180673eda.218.2019.10.30.11.57.46; Wed, 30 Oct 2019 11:58:10 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jb8vok3s; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727307AbfJ3Q1B (ORCPT + 99 others); Wed, 30 Oct 2019 12:27:01 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:46057 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726261AbfJ3Q1A (ORCPT ); Wed, 30 Oct 2019 12:27:00 -0400 Received: by mail-io1-f67.google.com with SMTP id s17so3195610iol.12; Wed, 30 Oct 2019 09:27:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+uwntaunJvEfF6N2JBmOpTRxiy4nvBNTDpuqDzHj3b0=; b=jb8vok3svlRvK8XDUQ92351D1Ta07Su1zLqkfJQKRnlsMXqPFxg8GRu9c0GaiP+aZd O00jWQA1J4GoLIDboqupHxa6yXVKqnk+pq4vlQ+q00f5W5IrhfkxFHZX8N/ntFo4q1JS qwyTWdpovHYWbX3hcKDq/8CoqxMV3ZhOzTJjOhYU6yVFa5lEZH1YVGHg/0J2LbBOgnag jD8y4fZZKQtSQY9VMrx4L9WfzDGZVPQrSZKmj5fR/2QXBusoZIq2tZtkihkcQn2DU/Il JmM3egjeyeOhbOmhOj+Pj0pYidsadh79q38qZPLtbO3E3Wpxg2C0iQkMDlx9hSLVo5kG FMGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+uwntaunJvEfF6N2JBmOpTRxiy4nvBNTDpuqDzHj3b0=; b=coc7DRcLoZ2sSVcFErCfdNDvkeomvMLb13mfLZGHU4zoRDfJsLU+0l42flfmaKS4vZ ICmcFk/FqFi5n4BSo8f/ZKT4kANdhuAeNkhCllctxlPabQ0ALKBbfoZYSMzL/Wz1bR+9 P0ShtrF6CJULlhlXsf6NH1Ag+sor0u1QWN0f9NVyq9pebRTytyF3bTiUpTRaURmzPMiN UV/eyWmH2Gk+FnBx51Btd01MFsBQUxFvZ0qsxPVdPrC1oD9qUcPLKniPAmNBwBjvqIC5 y9IjkfP3tiF8azumYWJvfdVOZ+tgTt+AtKx7M02ohPuNqMedBkRkZw1n9oqwoUdytzRX XZcA== X-Gm-Message-State: APjAAAVmz9Q2NCP5RVuV8BVODqEkR6ay34ubV571bs+4ghOfz0YtzN+a HVONRuuP/X+8mATNAlCUq9zgRgngN3JKZPXU8y0= X-Received: by 2002:a6b:7006:: with SMTP id l6mr648689ioc.298.1572452819891; Wed, 30 Oct 2019 09:26:59 -0700 (PDT) MIME-Version: 1.0 References: <20190620062246.2665-1-e5ten.arch@gmail.com> <20191029210250.17007-1-e5ten.arch@gmail.com> In-Reply-To: From: Ethan Sommer Date: Wed, 30 Oct 2019 12:26:49 -0400 Message-ID: Subject: Re: [PATCH v3] replace timeconst bc script with an sh script To: Kieran Bingham Cc: "H . Peter Anvin" , Jonathan Corbet , Federico Vaga , "Chang S. Bae" , Andrew Morton , Arnd Bergmann , Masahiro Yamada , Ingo Molnar , Borislav Petkov , Mark Rutland , John Stultz , Kees Cook , Corey Minyard , Thomas Gleixner , linux-doc@vger.kernel.org, Linux Kernel Mailing List , Linux-Renesas Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Running shellcheck on kernel/time/timeconst.sh produces the following > warnings: > > shellcheck kernel/time/timeconst.sh > > In kernel/time/timeconst.sh line 11: > local i=1 j=0 > ^-- SC2039: In POSIX sh, 'local' is undefined. > > > In kernel/time/timeconst.sh line 20: > local i="$1" j="$2" k > ^-- SC2039: In POSIX sh, 'local' is undefined. > > > In kernel/time/timeconst.sh line 34: > local i > ^-- SC2039: In POSIX sh, 'local' is undefined. > > > In kernel/time/timeconst.sh line 44: > local i=0 j > ^-- SC2039: In POSIX sh, 'local' is undefined. > > > > Will this cause an issue for people running posix shells? > Which shells have you tested your script on ? While local is not part of POSIX, it is widely supported, including by dash, and is used by many shell scripts in the kernel's build including link-vmlinux.sh, however I can easily make the script work without local by using unique variable names in each function and resetting all of them at the beginning of the functions if that is desired instead of local. > > Furthermore, I fear this conversion may not be suitable at present, as > it produces potentially different results for CONFIG_HZ < 100 > > (There may be more diffs, but I haven't yet compared a larger search space) > > using a quick script I put together to compare the output of > timeconst.sh and timeconst.bc for a given CONFIG_HZ: > > > https://gist.github.com/kbingham/76e8718df7b7dc97361405cc1801a160 > > > $ for i in `seq 0 300`; do ./check-timeconst.sh $i; done > > produces a diff on almost every value 2 - 243 > > http://paste.ubuntu.com/p/wNggrfFZXB/ > > Or rather 137 faults to be exact: > > for i in `seq 0 250`; \ > do ./check-timeconst.sh $i; \ > done | grep -- "--- BC" | wc -l > > > I think that might be considered a blocker to this implementation, or > those values and the impact should certainly be investigated thoroughly. > > I haven't looked into detail into the change of any of those values, so > I can not ascertain which one is more correct (though I suspect it's > likely to be bc that will have the 'more correct' value) > > I would fear doing this in shell just isn't going to maintain the > correct precision, which is likely a strong reason why bc was selected > in the first place. > > > If you can find the issue that causes this diff in your shell > processing, and clarify or fix it - then it might be possible to gain > some backing to the implementation, but even then it might become a > shell specific precision issue ... That definitely is a blocker, I will attempt to make this implementation match the bc script for those values.