From patchwork Sat Sep 3 16:29:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nikunj A. Dadhania" X-Patchwork-Id: 9312153 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C967C60760 for ; Sat, 3 Sep 2016 16:30:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 90A4A28249 for ; Sat, 3 Sep 2016 16:30:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8155A283F0; Sat, 3 Sep 2016 16:30:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BAC4628249 for ; Sat, 3 Sep 2016 16:30:03 +0000 (UTC) Received: from localhost ([::1]:47070 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgDpR-00061u-7S for patchwork-qemu-devel@patchwork.kernel.org; Sat, 03 Sep 2016 12:30:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51796) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgDp5-00061H-6l for qemu-devel@nongnu.org; Sat, 03 Sep 2016 12:29:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bgDp1-0005VJ-1G for qemu-devel@nongnu.org; Sat, 03 Sep 2016 12:29:38 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:33318) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgDp0-0005VE-Oq for qemu-devel@nongnu.org; Sat, 03 Sep 2016 12:29:34 -0400 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u83GN9Qi111749 for ; Sat, 3 Sep 2016 12:29:33 -0400 Received: from e23smtp08.au.ibm.com (e23smtp08.au.ibm.com [202.81.31.141]) by mx0a-001b2d01.pphosted.com with ESMTP id 257tnyck7t-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Sat, 03 Sep 2016 12:29:33 -0400 Received: from localhost by e23smtp08.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 4 Sep 2016 02:29:30 +1000 Received: from d23dlp03.au.ibm.com (202.81.31.214) by e23smtp08.au.ibm.com (202.81.31.205) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sun, 4 Sep 2016 02:29:28 +1000 X-IBM-Helo: d23dlp03.au.ibm.com X-IBM-MailFrom: nikunj@linux.vnet.ibm.com X-IBM-RcptTo: qemu-devel@nongnu.org;qemu-ppc@nongnu.org Received: from d23relay06.au.ibm.com (d23relay06.au.ibm.com [9.185.63.219]) by d23dlp03.au.ibm.com (Postfix) with ESMTP id EF6633578053; Sun, 4 Sep 2016 02:29:27 +1000 (EST) Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay06.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u83GTREn62193848; Sun, 4 Sep 2016 02:29:27 +1000 Received: from d23av03.au.ibm.com (localhost [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u83GTRRJ023474; Sun, 4 Sep 2016 02:29:27 +1000 Received: from abhimanyu.vnet.linux.ibm.com ([9.79.251.164]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u83GTG9v023428 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Sun, 4 Sep 2016 02:29:25 +1000 From: Nikunj A Dadhania To: Programmingkid , "list\@suse.de\:PowerPC list\:PowerPC" , Alex =?utf-8?Q?Benn=C3=A9e?= , David Gibson , rth@twiddle.net, qemu-devel qemu-devel In-Reply-To: <7D2DD011-6985-47EF-9950-8763102115BA@gmail.com> References: <7D2DD011-6985-47EF-9950-8763102115BA@gmail.com> User-Agent: Notmuch/0.21 (https://notmuchmail.org) Emacs/25.0.94.1 (x86_64-redhat-linux-gnu) Date: Sat, 03 Sep 2016 21:59:16 +0530 MIME-Version: 1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16090316-0048-0000-0000-000001B4E01A X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16090316-0049-0000-0000-00004678D24B Message-Id: <87a8fp3q1v.fsf@abhimanyu.i-did-not-set--mail-host-address--so-tickle-me> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-09-03_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1609030236 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] X-Received-From: 148.163.156.1 Subject: Re: [Qemu-devel] [Qemu-ppc] [PATCH RFC 0/4] Enable MTTCG on PowerPC X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP Programmingkid writes: >> On 09/02/2016 08:32 AM, Nikunj A Dadhania wrote: >>> The series is a first attempt at enabling Multi-Threaded TCG on PowerPC. >>> Changes that were needed to enable PowerPC are pretty simple; >>> >>> Patch 01: Take a iothread lock during hcall, as hcall can generate io requests >>> 02: For TCG, we were harcoding smt as 1, this gets rid of the limitation >>> 03: Use atomic_cmpxchg in store conditional >>> 04: With more threads, flush the entry from each cpu. >>> This can be optimized further. >>> >>> The patches are based on the Alex Bennee's base enabling patches for >>> MTTCG[1] and Emilios's cmpxchg atomics. The consolidated tree of the >>> above patches is here: >>> >>> https://github.com/stsquad/qemu/tree/mttcg/base-patches-v4-with-cmpxchg-atomics-v2 >>> >>> Apart from the above, PPC patches are based out of ppc-for-2.8 and >>> load/store consolidation patches [2] >>> >>> Series with all dependent patches available here: >>> https://github.com/nikunjad/qemu/tree/ppc_mttcg_v1 >>> >>> Testing: >>> ======== >>> >>> -smp 4,cores=1,threads=4 -accel tcg,thread=multi >>> >>> TODO >>> ==== >>> Implement msgsndp instructions(door-bell), newer kernels enable it >>> depending on the PVR. I have been using following workaround to boot. >>> https://github.com/nikunjad/qemu/commit/2c10052c5f93418a6b920e6ba3ce1813fcf50bc4 >> >> You could also introduce a Power8 DD1 in qemu. From the kernel cputable : >> >> { /* Power8 DD1: Does not support doorbell IPIs */ >> .pvr_mask = 0xffffff00, >> .pvr_value = 0x004d0100, >> .cpu_name = "POWER8 (raw)", >> .cpu_features = CPU_FTRS_POWER8_DD1, >> ... >> >> Cheers, >> C. > > What I did: > > git clone https://github.com/nikunjad/qemu/tree/ppc_mttcg_v1 > > git checkout ppc_mttcg_v1 > > ./configure --target-list=ppc-softmmu,i386-softmmu --cxx=gcc-4.9 --cc=gcc-4.9 --objcc=gcc-4.9 --disable-gtk --disable-sdl && make > > After these steps I tried to test Windows XP and Windows 2000 using this command line: > ./i386-softmmu/qemu-system-i386 -name 'Windows XP' -hda 'Windows XP Hard Drive.img' -boot c -smp 4,cores=1,threads=4 -accel tcg,thread=multi I haven't enabled x86. Not sure if that is supported in Alex Bennee's tree either. > > This causes QEMU to crash. The cause is an abort trap. This is what I captured: > > Thread 7 Crashed: > 0 libSystem.B.dylib 0x00007fff825559ce __semwait_signal_nocancel + 10 > 1 libSystem.B.dylib 0x00007fff825558d0 nanosleep$NOCANCEL + 129 > 2 libSystem.B.dylib 0x00007fff825b23ce usleep$NOCANCEL + 57 > 3 libSystem.B.dylib 0x00007fff825d1a00 abort + 93 > 4 qemu-system-i386 0x0000000100036c65 qemu_tcg_cpu_thread_fn + 325 (cpus.c:1384) > 5 libSystem.B.dylib 0x00007fff8251bfd6 _pthread_start + 331 > 6 libSystem.B.dylib 0x00007fff8251be89 thread_start + 13 > > Trying Windows 2000 also causes the same crash. > > I then tried Mac OS 10.4. The command line was: > ./ppc-softmmu/qemu-system-ppc -smp 4,cores=1,threads=4 -M mac99 -m 512 -hda 'Mac OS 10.4.0.qcow2' -boot c -prom-env boot-args=-v -localtime I have tested with ppc64-softmmu. Haven't tried ppc-softmmu yet. > > The result was this error message: > qemu-system-ppc: Number of SMP CPUs requested (4) exceeds max CPUs > supported by machine 'mac99' (1) This seems to be similar error which I got when enabling ppc64. 02/04 of my patch has got over the limitation for ppc64. I guess some patch seems to be missing for ppc. I thought that something like this should work: ======================================================================== But I do not see this print at all. core99_machine_class_init() doesnt get called ? Am I missing something? Regards Nikunj ======================================================================== diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h index 20cbddb..e6522e5 100644 --- a/hw/ppc/mac.h +++ b/hw/ppc/mac.h @@ -32,7 +32,7 @@ #include "hw/input/adb.h" /* SMP is not enabled, for now */ -#define MAX_CPUS 1 +#define MAX_CPUS 4 #define BIOS_SIZE (1024 * 1024) #define NVRAM_SIZE 0x2000 diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 7d25106..13e7d1c 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -515,6 +515,7 @@ static void core99_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); + fprintf(stderr, "%s: init %d\n", __func__, MAX_CPUS); mc->desc = "Mac99 based PowerMAC"; mc->init = ppc_core99_init; mc->max_cpus = MAX_CPUS;