From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Juan Quintela <quintela@redhat.com>,
qemu-devel <qemu-devel@nongnu.org>,
thuth@redhat.com, Andrea Arcangeli <aarcange@redhat.com>
Subject: Re: [Qemu-devel] postcopy migration hangs while loading virtio state
Date: Tue, 4 Jul 2017 10:16:43 +0200 [thread overview]
Message-ID: <20170704101643.3c20f745@mschwideX1> (raw)
In-Reply-To: <55708cff-cdda-9b1d-2106-1c6d2774f890@de.ibm.com>
On Tue, 4 Jul 2017 09:48:11 +0200
Christian Borntraeger <borntraeger@de.ibm.com> wrote:
> On 07/03/2017 09:07 PM, Dr. David Alan Gilbert wrote:
> > * Michael S. Tsirkin (mst@redhat.com) wrote:
> >> On Fri, Jun 30, 2017 at 05:31:39PM +0100, Dr. David Alan Gilbert wrote:
> >>> * Christian Borntraeger (borntraeger@de.ibm.com) wrote:
> >>>> On 04/26/2017 01:45 PM, Christian Borntraeger wrote:
> >>>>
> >>>>>> Hmm, I have a theory, if the flags field has bit 1 set, i.e. RAM_SAVE_FLAG_COMPRESS
> >>>>>> then try changing ram_handle_compressed to always do the memset.
> >>>>>
> >>>>> FWIW, changing ram_handle_compressed to always memset makes the problem go away.
> >>>>
> >>>> It is still running fine now with the "always memset change"
> >>>
> >>> Did we ever nail down a fix for this; as I remember Andrea said
> >>> we shouldn't need to do that memset, but we came to the conclusion
> >>> it was something specific to how s390 protection keys worked.
> >>>
> >>> Dave
> >>
> >> No we didn't. Let's merge that for now, with a comment that
> >> we don't really understand what's going on?
> >
> > Hmm no, I don't really want to change the !s390 behaviour, especially
> > since it causes allocation that we otherwise avoid and Andrea's
> > reply tothe original post pointed out it's not necessary.
>
>
> Since storage keys are per physical page we must not have shared pages.
> Therefore in s390_enable_skey we already do a break_ksm (via ksm_madvise),
> in other words we already allocate pages on the keyless->keyed switch.
>
> So why not do the same for zero pages - instead of invalidating the page
> table entry, lets just do a proper COW.
>
> Something like this maybe (Andrea, Martin any better way to do that?)
>
>
> diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c
> index 4fb3d3c..11475c7 100644
> --- a/arch/s390/mm/gmap.c
> +++ b/arch/s390/mm/gmap.c
> @@ -2149,13 +2149,18 @@ EXPORT_SYMBOL_GPL(s390_enable_sie);
> static int __s390_enable_skey(pte_t *pte, unsigned long addr,
> unsigned long next, struct mm_walk *walk)
> {
> + struct page *page;
> /*
> - * Remove all zero page mappings,
> + * Remove all zero page mappings with a COW
> * after establishing a policy to forbid zero page mappings
> * following faults for that page will get fresh anonymous pages
> */
> - if (is_zero_pfn(pte_pfn(*pte)))
> - ptep_xchg_direct(walk->mm, addr, pte, __pte(_PAGE_INVALID));
> + if (is_zero_pfn(pte_pfn(*pte))) {
> + if (get_user_pages(addr, 1, FOLL_WRITE, &page, NULL) == 1)
> + put_page(page);
> + else
> + return -ENOMEM;
> + }
> /* Clear storage key */
> ptep_zap_key(walk->mm, addr, pte);
> return 0;
I do not quite get the problem here. The zero-page mappings are always
marked as _PAGE_SPECIAL. These should be safe to replace with an empty
pte. We do mark all VMAs as unmergeable prior to the page table walk
that replaces all zero-page mappings. What is the get_user_pages() call
supposed to do?
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
next prev parent reply other threads:[~2017-07-04 8:16 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-24 10:31 [Qemu-devel] postcopy migration hangs while loading virtio state Christian Borntraeger
2017-04-24 10:53 ` Dr. David Alan Gilbert
2017-04-24 13:02 ` Christian Borntraeger
2017-04-24 14:35 ` Dr. David Alan Gilbert
2017-04-24 18:17 ` Christian Borntraeger
2017-04-24 19:12 ` Dr. David Alan Gilbert
2017-04-25 13:27 ` Christian Borntraeger
2017-04-26 9:59 ` Christian Borntraeger
2017-04-26 10:13 ` Christian Borntraeger
2017-04-26 11:01 ` Dr. David Alan Gilbert
2017-04-26 11:37 ` Christian Borntraeger
2017-04-26 11:45 ` Christian Borntraeger
2017-04-26 12:07 ` Christian Borntraeger
2017-06-30 16:31 ` Dr. David Alan Gilbert
2017-07-03 14:28 ` Christian Borntraeger
2017-07-03 16:25 ` Michael S. Tsirkin
2017-07-03 19:07 ` Dr. David Alan Gilbert
2017-07-04 7:48 ` Christian Borntraeger
2017-07-04 8:16 ` Martin Schwidefsky [this message]
2017-07-04 8:27 ` Christian Borntraeger
2017-07-10 8:05 ` Christian Borntraeger
2017-04-24 13:11 ` 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=20170704101643.3c20f745@mschwideX1 \
--to=schwidefsky@de.ibm.com \
--cc=aarcange@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=dgilbert@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@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 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.