All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>, kvm@vger.kernel.org
Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
	Vasily Gorbik <gor@linux.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	Cornelia Huck <cohuck@redhat.com>,
	Janosch Frank <frankja@linux.ibm.com>,
	stable@vger.kernel.org
Subject: Re: [PATCH v2 1/5] KVM: s390: vsie: Fix region 1 ASCE sanity shadow address checks
Date: Tue, 7 Apr 2020 09:49:07 +0200	[thread overview]
Message-ID: <c5c9fdcd-37ce-029d-a412-8987a901a116@redhat.com> (raw)
In-Reply-To: <ee3f6c69-4401-066d-6f87-806667facf35@de.ibm.com>

On 07.04.20 09:33, Christian Borntraeger wrote:
> 
> On 03.04.20 17:30, David Hildenbrand wrote:
>> In case we have a region 1 ASCE, our shadow/g3 address can have any value.
>> Unfortunately, (-1UL << 64) is undefined and triggers sometimes,
>> rejecting valid shadow addresses when trying to walk our shadow table
>> hierarchy.
>>
>> The result is that the prefix cannot get mapped and will loop basically
>> forever trying to map it (-EAGAIN loop).
>>
>> After all, the broken check is only a sanity check, our table shadowing
>> code in kvm_s390_shadow_tables() already checks these conditions, injecting
>> proper translation exceptions. Turn it into a WARN_ON_ONCE().
> 
> After some testing I now triggered this warning:
> 
> [  541.633114] ------------[ cut here ]------------
> [  541.633128] WARNING: CPU: 38 PID: 2812 at arch/s390/mm/gmap.c:799 gmap_shadow_pgt_lookup+0x98/0x1a0
> [  541.633129] Modules linked in: vhost_net vhost macvtap macvlan tap kvm xt_CHECKSUM xt_MASQUERADE nf_nat_tftp nf_conntrack_tftp xt_CT tun bridge stp llc xt_tcpudp ip6t_REJECT nf_reject_ipv6 ip6t_rpfilter ipt_REJECT nf_reject_ipv4 xt_conntrack ip6table_nat ip6table_mangle ip6table_raw ip6table_security iptable_nat nf_nat iptable_mangle iptable_raw iptable_security nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip_set nfnetlink ip6table_filter ip6_tables iptable_filter rpcrdma sunrpc rdma_ucm rdma_cm iw_cm ib_cm configfs mlx5_ib s390_trng ghash_s390 prng aes_s390 ib_uverbs des_s390 ib_core libdes sha3_512_s390 genwqe_card sha3_256_s390 vfio_ccw crc_itu_t vfio_mdev sha512_s390 mdev vfio_iommu_type1 sha1_s390 vfio eadm_sch zcrypt_cex4 sch_fq_codel ip_tables x_tables mlx5_core sha256_s390 sha_common pkey zcrypt rng_core autofs4
> [  541.633164] CPU: 38 PID: 2812 Comm: CPU 0/KVM Not tainted 5.6.0+ #354
> [  541.633166] Hardware name: IBM 3906 M04 704 (LPAR)
> [  541.633167] Krnl PSW : 0704d00180000000 00000014e05dc454 (gmap_shadow_pgt_lookup+0x9c/0x1a0)
> [  541.633169]            R:0 T:1 IO:1 EX:1 Key:0 M:1 W:0 P:0 AS:3 CC:1 PM:0 RI:0 EA:3
> [  541.633171] Krnl GPRS: 0000000000000000 0000001f00000000 0000001f487b8000 ffffffff80000000
> [  541.633172]            ffffffffffffffff 000003e003defa18 000003e003defa1c 000003e003defa18
> [  541.633173]            fffffffffffff000 000003e003defa18 000003e003defa28 0000001f70e06300
> [  541.633174]            0000001f43484000 00000000043ed200 000003e003def978 000003e003def920
> [  541.633203] Krnl Code: 00000014e05dc448: b9800038		ngr	%r3,%r8
>                           00000014e05dc44c: a7840014		brc	8,00000014e05dc474
>                          #00000014e05dc450: af000000		mc	0,0
>                          >00000014e05dc454: a728fff5		lhi	%r2,-11
>                           00000014e05dc458: a7180000		lhi	%r1,0
>                           00000014e05dc45c: b2fa0070		niai	7,0
>                           00000014e05dc460: 4010b04a		sth	%r1,74(%r11)
>                           00000014e05dc464: b9140022		lgfr	%r2,%r2
> [  541.633215] Call Trace:
> [  541.633218]  [<00000014e05dc454>] gmap_shadow_pgt_lookup+0x9c/0x1a0 
> [  541.633257]  [<000003ff804c57d6>] kvm_s390_shadow_fault+0x66/0x1e8 [kvm] 
> [  541.633265]  [<000003ff804c72dc>] vsie_run+0x43c/0x710 [kvm] 
> [  541.633273]  [<000003ff804c85ca>] kvm_s390_handle_vsie+0x632/0x750 [kvm] 
> [  541.633281]  [<000003ff804c123c>] kvm_s390_handle_b2+0x84/0x4e0 [kvm] 
> [  541.633289]  [<000003ff804b46b2>] kvm_handle_sie_intercept+0x172/0xcb8 [kvm] 
> [  541.633297]  [<000003ff804b18a8>] __vcpu_run+0x658/0xc90 [kvm] 
> [  541.633305]  [<000003ff804b2920>] kvm_arch_vcpu_ioctl_run+0x248/0x858 [kvm] 
> [  541.633313]  [<000003ff8049d454>] kvm_vcpu_ioctl+0x284/0x7b0 [kvm] 
> [  541.633316]  [<00000014e087d5ae>] ksys_ioctl+0xae/0xe8 
> [  541.633318]  [<00000014e087d652>] __s390x_sys_ioctl+0x2a/0x38 
> [  541.633323]  [<00000014e0ff02a2>] system_call+0x2a6/0x2c8 
> [  541.633323] Last Breaking-Event-Address:
> [  541.633334]  [<000003ff804983e0>] kvm_running_vcpu+0x3ea9ee997d8/0x3ea9ee99950 [kvm]
> [  541.633335] ---[ end trace f69b6021855ea189 ]---
> 
> 
> Unfortunately no dump at that point in time.
> I have other tests which are clearly fixed by this patch, so we should propbably go forward anyway.
> Question is, is this just another bug we need to fix or is the assumption that somebody else checked 
> all conditions so we can warn false?

Yeah, I think it is via

kvm_s390_shadow_fault()->gmap_shadow_pgt_lookup()->gmap_table_walk()

where we just peek if there is already something shadowed. If not, we go
via the full kvm_s390_shadow_tables() path.

So we could either do sanity checks in gmap_shadow_pgt_lookup(), or
rather drop the WARN_ON_ONCE. I think the latter makes sense, now that
we understood the problem.

-- 
Thanks,

David / dhildenb


  reply	other threads:[~2020-04-07  7:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-03 15:30 [PATCH v2 0/5] KVM: s390: vsie: fixes and cleanups David Hildenbrand
2020-04-03 15:30 ` [PATCH v2 1/5] KVM: s390: vsie: Fix region 1 ASCE sanity shadow address checks David Hildenbrand
2020-04-03 17:56   ` Christian Borntraeger
2020-04-03 19:55     ` David Hildenbrand
2020-04-06  8:32       ` Christian Borntraeger
2020-04-07  7:33   ` Christian Borntraeger
2020-04-07  7:49     ` David Hildenbrand [this message]
2020-04-07  7:52       ` Christian Borntraeger
2020-04-07  7:53         ` David Hildenbrand
2020-04-07 10:48         ` Claudio Imbrenda
2020-04-03 15:30 ` [PATCH v2 2/5] KVM: s390: vsie: Fix delivery of addressing exceptions David Hildenbrand
2020-04-07 11:00   ` Claudio Imbrenda
2020-04-07 11:35     ` David Hildenbrand
2020-04-03 15:30 ` [PATCH v2 3/5] KVM: s390: vsie: Fix possible race when shadowing region 3 tables David Hildenbrand
2020-04-07 11:05   ` Claudio Imbrenda
2020-04-03 15:30 ` [PATCH v2 4/5] KVM: s390: vsie: Move conditional reschedule David Hildenbrand
2020-04-06 15:06   ` Christian Borntraeger
2020-04-07 10:52   ` Claudio Imbrenda
2020-04-03 15:30 ` [PATCH v2 5/5] KVM: s390: vsie: gmap_table_walk() simplifications David Hildenbrand
2020-04-06 16:06   ` Christian Borntraeger
2020-04-07 11:10   ` Claudio Imbrenda
2020-04-06 16:06 ` [PATCH v2 0/5] KVM: s390: vsie: fixes and cleanups Christian Borntraeger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c5c9fdcd-37ce-029d-a412-8987a901a116@redhat.com \
    --to=david@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=frankja@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.