Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751729AbdLLJ3p (ORCPT ); Tue, 12 Dec 2017 04:29:45 -0500 Received: from szxga05-in.huawei.com ([45.249.212.191]:11972 "EHLO szxga05-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750749AbdLLJ3l (ORCPT ); Tue, 12 Dec 2017 04:29:41 -0500 Subject: Re: [PATCH] rcutorture: Add basic ARM64 support to run scripts To: CC: , , , References: <1512728023-37977-1-git-send-email-lianglihao@huawei.com> <20171211163243.GR7829@linux.vnet.ibm.com> From: Lihao Liang Message-ID: Date: Tue, 12 Dec 2017 17:28:48 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20171211163243.GR7829@linux.vnet.ibm.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.151.18.148] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.5A2FA167.002F,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 9e71f821a831a0930b6002b66f95db24 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3413 Lines: 127 Hi Paul, Many thanks for your helpful comments! I have addressed all of them in a new version of the patch, which is sent out in a separate email. If you have further comments, please let me know. Best regards, Lihao. On 2017/12/12 0:32, Paul E. McKenney wrote: > On Fri, Dec 08, 2017 at 06:13:43PM +0800, lianglihao@huawei.com wrote: >> From: Lihao Liang >> >> This commit adds support of the qemu command qemu-system-aarch64 >> to rcutorture. Use the following command to run: >> >> ./kvm.sh --qemu-cmd qemu-system-aarch64 >> >> Signed-off-by: Lihao Liang > > Nice!!! Getting ARM support for rcutorture has been on my todo list > for some time! > > A few questions and comments below. > > Feedback from ARM experts also welcome! > > Thanx, Paul > >> --- >> >> The max CPUs supported by qemu machine 'virt' is 8 so the value of >> CONFIG_NR_CPUS in some test configuration files needs to be adjusted. >> >> tools/testing/selftests/rcutorture/bin/functions.sh | 18 +++++++++++++++++- >> 1 file changed, 17 insertions(+), 1 deletion(-) >> >> diff --git a/tools/testing/selftests/rcutorture/bin/functions.sh b/tools/testing/selftests/rcutorture/bin/functions.sh >> index 07a1377..5ffe4fe 100644 >> --- a/tools/testing/selftests/rcutorture/bin/functions.sh >> +++ b/tools/testing/selftests/rcutorture/bin/functions.sh >> @@ -136,6 +136,9 @@ identify_boot_image () { >> qemu-system-x86_64|qemu-system-i386) >> echo arch/x86/boot/bzImage >> ;; >> + qemu-system-aarch64) >> + echo arch/arm64/boot/Image >> + ;; >> *) >> echo vmlinux >> ;; > > Is it possible to automatically select ARM based on the kernel binary? > See the identify_qemu function for how this is done for i386, x86_64, > and PowerPC. Can an "elif" be added for ARM? > >> @@ -185,7 +188,14 @@ identify_qemu_append () { >> then >> echo root=/dev/sda >> else >> - echo console=ttyS0 >> + case "$1" in >> + qemu-system-aarch64) >> + echo console=ttyAMA0 >> + ;; >> + *) >> + echo console=ttyS0 >> + ;; >> + esac >> fi >> } > > This approach is going to result in very ugly nesting if support is > added for additional CPU families. How about something like this? > > identify_qemu_append () { > local console=ttyS0 > > case "$1" in > qemu-system-x86_64|qemu-system-i386) > echo noapic selinux=0 initcall_debug debug > ;; > qemu-system-aarch64) > console=ttyAMA0 > ;; > esac > if test -n "$TORTURE_QEMU_INTERACTIVE" > then > echo root=/dev/sda > else > echo console=$console > fi > } > >> @@ -197,6 +207,9 @@ identify_qemu_args () { >> case "$1" in >> qemu-system-x86_64|qemu-system-i386) >> ;; >> + qemu-system-aarch64) >> + echo -M virt -cpu host >> + ;; >> qemu-system-ppc64) >> echo -enable-kvm -M pseries -nodefaults >> echo -device spapr-vscsi >> @@ -257,6 +270,9 @@ specify_qemu_cpus () { >> qemu-system-x86_64|qemu-system-i386) > > How about the following instead, eliminating the need for an additional > case? > > qemu-system-x86_64|qemu-system-i386!qemu-system-aarch64) > >> echo $2 -smp $3 >> ;; >> + qemu-system-aarch64) >> + echo $2 -smp $3 >> + ;; >> qemu-system-ppc64) >> nt="`lscpu | grep '^NUMA node0' | sed -e 's/^[^,]*,\([0-9]*\),.*$/\1/'`" >> echo $2 -smp cores=`expr \( $3 + $nt - 1 \) / $nt`,threads=$nt >> -- >> 2.7.4 >> > > > . >