Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:57370 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750752AbdGNFU5 (ORCPT ); Fri, 14 Jul 2017 01:20:57 -0400 Date: Fri, 14 Jul 2017 15:20:45 +1000 From: David Gibson To: Laurent Vivier Cc: rhkernel-list@redhat.com, rhvirt-patches@redhat.com, thuth@redhat.com, Paul Mackerras , stable@vger.kernel.org Subject: Re: [Pegas-1.0 kernel PATCH] KVM: PPC: Book3S: Fix typo in XICS-on-XIVE state saving code Message-ID: <20170714152045.7282e03b@umbus.fritz.box> In-Reply-To: <20170713095701.455-1-lvivier@redhat.com> References: <20170713095701.455-1-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/JkSjzz6JyE60AQoYL0QZduQ"; protocol="application/pgp-signature" Sender: stable-owner@vger.kernel.org List-ID: --Sig_/JkSjzz6JyE60AQoYL0QZduQ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Thu, 13 Jul 2017 11:57:01 +0200 Laurent Vivier wrote: > From: Paul Mackerras >=20 > This fixes a typo where the wrong loop index was used to index > the kvmppc_xive_vcpu.queues[] array in xive_pre_save_scan(). > The variable i contains the vcpu number; we need to index queues[] > using j, which iterates from 0 to KVMPPC_XIVE_Q_COUNT-1. >=20 > The effect of this bug is that things that save the interrupt > controller state, such as "virsh dump", on a VM with more than > 8 vCPUs, result in xive_pre_save_queue() getting called on a > bogus queue structure, usually resulting in a crash like this: >=20 > [ 501.821107] Unable to handle kernel paging request for data at address= 0x00000084 > [ 501.821212] Faulting instruction address: 0xc008000004c7c6f8 > [ 501.821234] Oops: Kernel access of bad area, sig: 11 [#1] > [ 501.821305] SMP NR_CPUS=3D1024 > [ 501.821307] NUMA > [ 501.821376] PowerNV > [ 501.821470] Modules linked in: vhost_net vhost tap xt_CHECKSUM ipt_MAS= QUERADE nf_nat_masquerade_ipv4 ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 nf_= conntrack_ipv6 nf_defrag_ipv6 xt_conntrack ip_set nfnetlink ebtable_nat ebt= able_broute bridge stp llc ip6table_mangle ip6table_security ip6table_raw i= ptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack= libcrc32c iptable_mangle iptable_security iptable_raw ebtable_filter ebtab= les ip6table_filter ip6_tables ses enclosure scsi_transport_sas ipmi_powern= v ipmi_devintf ipmi_msghandler powernv_op_panel kvm_hv nfsd auth_rpcgss oid= _registry nfs_acl lockd grace sunrpc kvm tg3 ptp pps_core > [ 501.822477] CPU: 3 PID: 3934 Comm: live_migration Not tainted 4.11.0-4= .git8caa70f.el7.centos.ppc64le #1 > [ 501.822633] task: c0000003f9e3ae80 task.stack: c0000003f9ed4000 > [ 501.822745] NIP: c008000004c7c6f8 LR: c008000004c7c628 CTR: 0000000030= 058018 > [ 501.822877] REGS: c0000003f9ed7980 TRAP: 0300 Not tainted (4.11.0-4= .git8caa70f.el7.centos.ppc64le) > [ 501.823030] MSR: 9000000000009033 > [ 501.823047] CR: 28022244 XER: 00000000 > [ 501.823203] CFAR: c008000004c7c77c DAR: 0000000000000084 DSISR: 400000= 00 SOFTE: 1 > [ 501.823203] GPR00: c008000004c7c628 c0000003f9ed7c00 c008000004c91450 = 00000000000000ff > [ 501.823203] GPR04: c0000003f5580000 c0000003f559bf98 9000000000009033 = 0000000000000000 > [ 501.823203] GPR08: 0000000000000084 0000000000000000 00000000000001e0 = 9000000000001003 > [ 501.823203] GPR12: c00000000008a7d0 c00000000fdc1b00 000000000a9a0000 = 0000000000000000 > [ 501.823203] GPR16: 00000000402954e8 000000000a9a0000 0000000000000004 = 0000000000000000 > [ 501.823203] GPR20: 0000000000000008 c000000002e8f180 c000000002e8f1e0 = 0000000000000001 > [ 501.823203] GPR24: 0000000000000008 c0000003f5580008 c0000003f4564018 = c000000002e8f1e8 > [ 501.823203] GPR28: 00003ff6e58bdc28 c0000003f4564000 0000000000000000 = 0000000000000000 > [ 501.825441] NIP [c008000004c7c6f8] xive_get_attr+0x3b8/0x5b0 [kvm] > [ 501.825671] LR [c008000004c7c628] xive_get_attr+0x2e8/0x5b0 [kvm] > [ 501.825887] Call Trace: > [ 501.825991] [c0000003f9ed7c00] [c008000004c7c628] xive_get_attr+0x2e8/= 0x5b0 [kvm] (unreliable) > [ 501.826312] [c0000003f9ed7cd0] [c008000004c62ec4] kvm_device_ioctl_att= r+0x64/0xa0 [kvm] > [ 501.826581] [c0000003f9ed7d20] [c008000004c62fcc] kvm_device_ioctl+0xc= c/0xf0 [kvm] > [ 501.826843] [c0000003f9ed7d40] [c000000000350c70] do_vfs_ioctl+0xd0/0x= 8c0 > [ 501.827060] [c0000003f9ed7de0] [c000000000351534] SyS_ioctl+0xd4/0xf0 > [ 501.827282] [c0000003f9ed7e30] [c00000000000b8e0] system_call+0x38/0xfc > [ 501.827496] Instruction dump: > [ 501.827632] 419e0078 3b760008 e9160008 83fb000c 83db0010 80fb0008 2f28= 0000 60000000 > [ 501.827901] 60000000 60420000 419a0050 7be91764 <7d284c2c> 552a0ffe 7f= 8af040 419e003c > [ 501.828176] ---[ end trace 2d0529a5bbbbafed ]--- >=20 > Cc: stable@vger.kernel.org > Fixes: 5af50993850a ("KVM: PPC: Book3S HV: Native usage of the XIVE inter= rupt controller") > Acked-by: Benjamin Herrenschmidt > Signed-off-by: Paul Mackerras > (cherry picked from commit 00c14757f6abacd78cad9b2690a0e1f42e4b76c8) > Signed-off-by: Laurent Vivier >=20 > BREW: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=3D13650= 295 > BZ: https://bugzilla.redhat.com/show_bug.cgi?id=3D1469362 > --- > arch/powerpc/kvm/book3s_xive.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/arch/powerpc/kvm/book3s_xive.c b/arch/powerpc/kvm/book3s_xiv= e.c > index 7807ee1..0283de2 100644 > --- a/arch/powerpc/kvm/book3s_xive.c > +++ b/arch/powerpc/kvm/book3s_xive.c > @@ -1256,8 +1256,8 @@ static void xive_pre_save_scan(struct kvmppc_xive *= xive) > if (!xc) > continue; > for (j =3D 0; j < KVMPPC_XIVE_Q_COUNT; j++) { > - if (xc->queues[i].qpage) > - xive_pre_save_queue(xive, &xc->queues[i]); > + if (xc->queues[j].qpage) > + xive_pre_save_queue(xive, &xc->queues[j]); > } > } > =20 > --=20 > 2.9.4 >=20 Acked-by: David Gibson --=20 David Gibson Principal Software Engineer, Virtualization, Red Hat --Sig_/JkSjzz6JyE60AQoYL0QZduQ Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAlloVK0ACgkQbDjKyiDZ s5LUcxAA0jKdUxeS2qJFA0Auf253RamfXGz5ZPAVQMKGst4S46cW+1u8nqDSgNlQ xrYkuaVrAGsuKp7OFK4NogEEY23t8dPFviJZgC7xsffvO179DMFpHk268aWNLfHw SkXYTUnM9v+eek1Os5tDMa5cLBpynU0hX5SOhH6MebXN45/+EZGXmooMczON/1zh PrB5MBubCMUc9FYuxN3QE2tZRjCqLa3hjJ4MnZEywo9/wvWUgG5TjhCTmTw33G5A l0d7h8EbL6+l995lr4f9EnbNVD+/nf/PMTQtXI5SJ+BXR2/KdbRHufyIi66hZFk/ YqAEgk6N5o2NzZEeyeEDV2T/0p2H+FLxTw0JwnScTLp/aag9wV1iPlvowyyBQKVX Sk/ASRvyPE4Oz8/+rwhuSwhOJ6bdC6Li/D1wvonz94ohOtIe/7vj4Nq9rtXlFTab Gg+o1khAkOm/p6jT8ZoSlIL9V/3m+WAQzs3nAA+0bzc3CjRpvKtMvf5StHHwTD+q tZSEe/MATQI+XGYkkQ5T80viMVSJu+cZY/QPEfay0zL2zY9+iUfjSBkbPF8lkH/8 tSptUS1D1Pr0ZtKWi+2Pygb9JILf8VhkW8hcnS8//HHUB6vq5gZ4E3wz+1fqNNlr a2xeloc2z1nyCV+UTPY++N0OZsji0/HGwrrtaV+VYr23EXBgrTA= =Ru/U -----END PGP SIGNATURE----- --Sig_/JkSjzz6JyE60AQoYL0QZduQ--