public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: David Vrabel <david.vrabel@citrix.com>,
	Andy Lutomirski <luto@amacapital.net>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Xen-devel@lists.xen.org,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Pavel Emelyanov <xemul@parallels.com>,
	Ingo Molnar <mingo@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: Regression: x86/mm: new _PTE_SWP_SOFT_DIRTY bit conflicts with existing use
Date: Wed, 21 Aug 2013 19:42:38 +0400	[thread overview]
Message-ID: <20130821154238.GV18673@moon> (raw)
In-Reply-To: <5214F09002000078000ED5C3@nat28.tlf.novell.com>

On Wed, Aug 21, 2013 at 03:53:36PM +0100, Jan Beulich wrote:
> >>> On 21.08.13 at 16:12, Cyrill Gorcunov <gorcunov@gmail.com> wrote:
> > On Wed, Aug 21, 2013 at 02:48:20PM +0100, David Vrabel wrote:
> >> All,
> >> 
> >> 179ef71c (mm: save soft-dirty bits on swapped pages) introduces a new
> >> PTE bit on x86 _PTE_SWP_SOFT_DIRTY which has the same value as _PTE_PSE
> >> and _PTE_PAT.
> >> 
> >> With a Xen PV guest, the use of the _PTE_PAT will result in the page
> >> having unexpected cachability which will introduce a range of subtle
> >> performance and correctness issues.  Xen programs the entry 4 in the PAT
> >> table with WC so a page that was previously WB will end up as WC.
> >> 
> > 
> > David, could you please explain, Xen keeps and analyze _PTE_PAT bit
> > for ptes which are not present?
> 
> No, the problem isn't with not-present PTEs (i.e. swap entries),
> but with present ones - the same bit (7) is being used for both,
> according to this comment:
> 
> /*
>  * Tracking soft dirty bit when a page goes to a swap is tricky.
>  * We need a bit which can be stored in pte _and_ not conflict
>  * with swap entry format. On x86 bits 6 and 7 are *not* involved
>  * into swap entry computation, but bit 6 is used for nonlinear
>  * file mapping, so we borrow bit 7 for soft dirty tracking.
>  */
> 
> Or are you telling me that the comment is misleading (at least me),
> and this applies only to not-present PTEs? And even then - where
> would the value of the original PAT bit be stored while swapped
> out (or is it impossible - now and forever - for WC pages to get
> swapped)?

Only to non-present ptes, as far as I know.

do_swap_page
	...
	pte = mk_pte(page, vma->vm_page_prot);

	/* new pte from vm_page_prot generated */
	...
	set_pte_at(mm, address, page_table, pte);
	/* and assigned to old place */

with soft dirty in swap it is somehow more weirdy

	pte = mk_pte(page, vma->vm_page_prot);
	...
	if (pte_swp_soft_dirty(orig_pte))
		pte = pte_mksoft_dirty(pte);
	set_pte_at(mm, address, page_table, pte);

orig_pte has pse bit set if page has been soft dirty
when it reached swap.

  parent reply	other threads:[~2013-08-21 15:42 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-21 13:48 Regression: x86/mm: new _PTE_SWP_SOFT_DIRTY bit conflicts with existing use David Vrabel
2013-08-21 13:53 ` konrad wilk
2013-08-21 14:11 ` H. Peter Anvin
2013-08-21 14:19   ` Cyrill Gorcunov
2013-08-21 14:22     ` H. Peter Anvin
2013-08-21 14:29       ` Cyrill Gorcunov
2013-08-21 16:30     ` Linus Torvalds
2013-08-21 16:42       ` Cyrill Gorcunov
2013-08-21 23:05       ` Cyrill Gorcunov
2013-08-21 23:42         ` Andi Kleen
2013-08-22  5:49           ` Cyrill Gorcunov
2013-08-22  6:37             ` Minchan Kim
2013-08-22 13:12               ` Cyrill Gorcunov
2013-08-27 22:04       ` Benjamin Herrenschmidt
2013-08-21 14:12 ` Cyrill Gorcunov
2013-08-21 14:22   ` H. Peter Anvin
2013-08-21 14:53   ` Jan Beulich
2013-08-21 14:58     ` H. Peter Anvin
2013-08-21 15:42     ` Cyrill Gorcunov [this message]
2013-08-21 16:03       ` Jan Beulich
2013-08-21 16:19         ` Cyrill Gorcunov
2013-08-21 16:56           ` David Vrabel
2013-08-21 17:25             ` Cyrill Gorcunov
2013-08-21 18:17               ` Cyrill Gorcunov
2013-08-21 18:50                 ` H. Peter Anvin
2013-08-21 19:03                   ` Cyrill Gorcunov
2013-08-21 19:07                     ` Andy Lutomirski
2013-08-21 19:20                       ` Cyrill Gorcunov
2013-08-21 19:21                       ` Pavel Emelyanov
2013-08-21 23:04                     ` Linus Torvalds
2013-08-22  0:51                       ` Dave Jones
2013-08-22  5:44                         ` Cyrill Gorcunov
2013-08-22  6:41                         ` Pavel Emelyanov
2013-08-22  7:47                       ` Jan Beulich
2013-08-22  9:32                       ` David Vrabel
2013-08-22 10:16                         ` Pavel Emelyanov
2013-08-22  6:56           ` Jan Beulich
2013-08-22  7:03             ` Cyrill Gorcunov
2013-08-22  7:27               ` Jan Beulich
2013-08-22 11:27                 ` Cyrill Gorcunov
2013-08-22 11:33                   ` Jan Beulich
2013-08-22 12:18                     ` Pavel Emelyanov
2013-08-21 17:28 ` Andy Lutomirski
2013-08-22  7:54   ` Jan Beulich

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=20130821154238.GV18673@moon \
    --to=gorcunov@gmail.com \
    --cc=JBeulich@suse.com \
    --cc=Xen-devel@lists.xen.org \
    --cc=akpm@linux-foundation.org \
    --cc=boris.ostrovsky@oracle.com \
    --cc=david.vrabel@citrix.com \
    --cc=hpa@zytor.com \
    --cc=konrad.wilk@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@redhat.com \
    --cc=torvalds@linux-foundation.org \
    --cc=xemul@parallels.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