From: Farhan Ali <alifm@linux.vnet.ibm.com>
To: Martin Schwidefsky <schwidefsky@de.ibm.com>,
Christian Borntraeger <borntraeger@de.ibm.com>
Cc: linux-s390 <linux-s390@vger.kernel.org>,
Thomas Huth <thuth@redhat.com>, Cornelia Huck <cohuck@redhat.com>,
famz@redhat.com, Heiko Carstens <heiko.carstens@de.ibm.com>,
QEMU Developers <qemu-devel@nongnu.org>,
mreitz@redhat.com, qemu-s390x@nongnu.org,
Hendrik Brueckner <brueckner@linux.vnet.ibm.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [BUG] I/O thread segfault for QEMU on s390x
Date: Wed, 7 Mar 2018 07:52:31 -0500 [thread overview]
Message-ID: <55bacbf2-8b30-1082-ff25-0174470c24b8@linux.vnet.ibm.com> (raw)
In-Reply-To: <20180306073458.24118b01@mschwideX1>
On 03/06/2018 01:34 AM, Martin Schwidefsky wrote:
> On Mon, 5 Mar 2018 20:08:45 +0100
> Christian Borntraeger <borntraeger@de.ibm.com> wrote:
>
>> Do you happen to run with a recent host kernel that has
>>
>> commit 7041d28115e91f2144f811ffe8a195c696b1e1d0
>> s390: scrub registers on kernel entry and KVM exit
>>
>> Can you run with this on top
>> diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
>> index 13a133a6015c..d6dc0e5e8f74 100644
>> --- a/arch/s390/kernel/entry.S
>> +++ b/arch/s390/kernel/entry.S
>> @@ -426,13 +426,13 @@ ENTRY(system_call)
>> UPDATE_VTIME %r8,%r9,__LC_SYNC_ENTER_TIMER
>> BPENTER __TI_flags(%r12),_TIF_ISOLATE_BP
>> stmg %r0,%r7,__PT_R0(%r11)
>> - # clear user controlled register to prevent speculative use
>> - xgr %r0,%r0
>> mvc __PT_R8(64,%r11),__LC_SAVE_AREA_SYNC
>> mvc __PT_PSW(16,%r11),__LC_SVC_OLD_PSW
>> mvc __PT_INT_CODE(4,%r11),__LC_SVC_ILC
>> stg %r14,__PT_FLAGS(%r11)
>> .Lsysc_do_svc:
>> + # clear user controlled register to prevent speculative use
>> + xgr %r0,%r0
>> # load address of system call table
>> lg %r10,__THREAD_sysc_table(%r13,%r12)
>> llgh %r8,__PT_INT_CODE+2(%r11)
>>
>>
>> To me it looks like that the critical section cleanup (interrupt during system call entry) might
>> save the registers again into ptregs but we have already zeroed out r0.
>> This patch moves the clearing of r0 after sysc_do_svc, which should fix the critical
>> section cleanup.
>>
>> Adding Martin and Heiko. Will spin a patch.
>
> Argh, yes. Thanks Chrisitan, this is it. I have been searching for the bug
> for days now. The point is that if the system call handler is interrupted
> after the xgr but before .Lsysc_do_svc the code at .Lcleanup_system_call
> repeats the stmg for %r0-%r7 but now %r0 is already zero.
>
> Please commit a patch for this and I'll will queue it up immediately.
>
This patch does fix the QEMU crash. I haven't seen the crash after
running the test case for more than a day. Thanks to everyone for taking
a look at this problem :)
Thanks
Farhan
prev parent reply other threads:[~2018-03-07 12:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-01 14:33 [Qemu-devel] [BUG] I/O thread segfault for QEMU on s390x Farhan Ali
2018-03-02 6:13 ` Fam Zheng
2018-03-02 15:35 ` Farhan Ali
2018-03-02 9:23 ` Stefan Hajnoczi
2018-03-02 15:30 ` Farhan Ali
2018-03-05 11:03 ` Stefan Hajnoczi
2018-03-05 18:45 ` Farhan Ali
2018-03-05 18:54 ` Christian Borntraeger
2018-03-05 19:07 ` Peter Maydell
2018-03-05 19:08 ` Christian Borntraeger
2018-03-05 19:43 ` Farhan Ali
2018-03-06 6:34 ` Martin Schwidefsky
2018-03-07 12:52 ` Farhan Ali [this message]
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=55bacbf2-8b30-1082-ff25-0174470c24b8@linux.vnet.ibm.com \
--to=alifm@linux.vnet.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=brueckner@linux.vnet.ibm.com \
--cc=cohuck@redhat.com \
--cc=famz@redhat.com \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-s390@vger.kernel.org \
--cc=mreitz@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@nongnu.org \
--cc=schwidefsky@de.ibm.com \
--cc=stefanha@redhat.com \
--cc=thuth@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).