Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752808AbdLKQcv (ORCPT ); Mon, 11 Dec 2017 11:32:51 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:40790 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752321AbdLKQcp (ORCPT ); Mon, 11 Dec 2017 11:32:45 -0500 Date: Mon, 11 Dec 2017 08:32:43 -0800 From: "Paul E. McKenney" To: lianglihao@huawei.com Cc: guohanjun@huawei.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, lihao.liang@gmail.com Subject: Re: [PATCH] rcutorture: Add basic ARM64 support to run scripts Reply-To: paulmck@linux.vnet.ibm.com References: <1512728023-37977-1-git-send-email-lianglihao@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1512728023-37977-1-git-send-email-lianglihao@huawei.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17121116-0048-0000-0000-00000212CB9A X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008190; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000244; SDB=6.00958723; UDB=6.00484796; IPR=6.00738745; BA=6.00005736; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00018482; XFM=3.00000015; UTC=2017-12-11 16:32:42 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17121116-0049-0000-0000-0000436D656E Message-Id: <20171211163243.GR7829@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-12-11_06:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1712110245 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2983 Lines: 113 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 >