mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
Cc: Roland Dreier <rdreier@cisco.com>,
	venkatesh.pallipadi@intel.com, ak@muc.de,
	torvalds@linux-foundation.org, gregkh@suse.de, airlied@skynet.ie,
	davej@redhat.com, mingo@elte.hu, tglx@linutronix.de,
	hpa@zytor.com, akpm@linux-foundation.org, arjan@infradead.org,
	jesse.barnes@intel.com, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 06/12] PAT 64b: Add ioremap_wc support
Date: Tue, 18 Dec 2007 01:29:45 -0700	[thread overview]
Message-ID: <m1fxy0be2u.fsf@ebiederm.dsl.xmission.com> (raw)
In-Reply-To: <20071214214026.GC717@linux-os.sc.intel.com> (Suresh B. Siddha's message of "Fri, 14 Dec 2007 13:40:27 -0800")

"Siddha, Suresh B" <suresh.b.siddha@intel.com> writes:

> Yes. We are looking for comments for our proposal to track the
> reserved/non-reserved regions some what different.
> This is the critical issue which had been holding off PAT for years now...

The mattr infrastructure appears to do a decent job of handling the
reserved page mapping case.  It essentially reinvents struct
vm_area_struct, and so I expect we can do things a little more easily
if we use the existing vm_area_struct with it's vm_page_prot member
for our checks, all rooted at a dummy reserved page inode.  That way
we don't need to do anything special on unmap.

For normal pages we always have them in the kernel mapping and
we use them there.  change_page_attr also comes in from the AGP
drivers and changes the caching attributes on a few of those.  So when
mapping a normal page we need to require it to be write-back or
whatever change_page_attr has set it to.  I expect 2 bits 
of page->flags with the proper default can handle that.

change_page_attr needs to check non kernel mappings of a page 
and either fix them or fail.

If we perform the checks I have described for normal pages
in /dev/mem (in remap_pfn_pages?) that should be our
most difficult case handled.

Eric

> <snip from the other mails>
>
> Change x86_64 identity map to only map non-reserved memory. This helps
> to handle UC/WC mapping of reserved region in a much simple manner
> (we don't have to do cpa any more, as such not keep track of the actual
> reference counts. We still track all the usages to keep the mappings
> consistent. We just avoid the headache of splitting mattr regions for
> managing ref counts for every individual usage of the reserved
> area).

Well we do want to early map the ``isa'' region.
>
> For now, we don't track RAM pages using memattr infrastructure. This is because,
> memattr infrastructure is not enough. i.e., while the page is getting
> tracked using memattr infrastructure, potentially the page can get
> freed(a bug that we need to catch, to avoid attribute aliasing).
> For example, a driver does ioremap_uc and an application mapped the
> same page using /dev/mem. When the driver does iounamp and free the page,
> /dev/mem mapping is still live and we run into aliasing issue.

/dev/mem is particular weird because it doesn't own the page, and thus
will always be the second user if we are talking about pages in ram.

> Can we use the existing page struct to keep track of the attribute
> and usage?

Yes but not the way you describe below.

> /dev/mem mappings then can increment the page ref count and not
> allow to free the page while the /dev/mem mappings are active. And allow
> /dev/mem to map only those pages which are marked reserved (which the driver
> does before doing iomap).

Part of the usefulness of /dev/mem is that it can do silly things like
map pages someone else in the kernel is using.  /dev/mem by it's very
nature does not own ram pages so we need to handle that differently.

> Or when a WB mapping through /dev/mem is active, don't allow any driver
> to map the page as UC.. Can we do this tracking for RAM pages through
> struct page. Or there any issues we should keep in mind..

I think some bits in page->flags should do the trick.  The semantics
of change_page_attr are interesting in this case.

Eric

  parent reply	other threads:[~2007-12-18  8:31 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-12-13 23:55 [RFC PATCH 00/12] PAT 64b: PAT support for X86_64 venkatesh.pallipadi
2007-12-13 23:55 ` [RFC PATCH 01/12] PAT 64b: Add cpu_shutdown() support venkatesh.pallipadi
2007-12-13 23:55 ` [RFC PATCH 02/12] PAT 64b: Basic PAT implementation venkatesh.pallipadi
2007-12-14  0:42   ` Andi Kleen
2007-12-14 18:31     ` Venki Pallipadi
2007-12-18  4:50       ` Eric W. Biederman
2007-12-14  3:48   ` Eric W. Biederman
2007-12-14  4:23     ` Eric W. Biederman
2007-12-14 21:10       ` Siddha, Suresh B
2007-12-14 23:34         ` Siddha, Suresh B
2007-12-15  7:55           ` Ingo Molnar
2007-12-14 10:25     ` Andi Kleen
2007-12-14 19:45       ` H. Peter Anvin
2007-12-18  4:42       ` Eric W. Biederman
2007-12-14 21:06     ` Siddha, Suresh B
2007-12-13 23:55 ` [RFC PATCH 03/12] PAT 64b: drm driver changes for PAT venkatesh.pallipadi
2007-12-13 23:55 ` [RFC PATCH 04/12] PAT 64b: reserve_mattr and free_mattr " venkatesh.pallipadi
2007-12-13 23:55 ` [RFC PATCH 05/12] PAT 64b: pci mmap conlfict patch venkatesh.pallipadi
2007-12-13 23:55 ` [RFC PATCH 06/12] PAT 64b: Add ioremap_wc support venkatesh.pallipadi
2007-12-14  4:17   ` Roland Dreier
2007-12-14  4:28     ` Eric W. Biederman
2007-12-14  4:32       ` Roland Dreier
2007-12-14  4:48         ` Eric W. Biederman
2007-12-14 21:40           ` Siddha, Suresh B
2007-12-14 23:19             ` Andi Kleen
2007-12-18  8:29             ` Eric W. Biederman [this message]
2007-12-13 23:55 ` [RFC PATCH 07/12] PAT 64b: dev mem chanegs for pat venkatesh.pallipadi
2007-12-13 23:55 ` [RFC PATCH 08/12] PAT 64b: coherent mmap and sysfs bin ioctl venkatesh.pallipadi
2007-12-14  0:19   ` Greg KH
2007-12-14  0:35     ` David Miller
2007-12-14  6:34       ` Greg KH
2007-12-16 21:57         ` Paul Mackerras
2007-12-17 12:41           ` Andi Kleen
2007-12-18  4:30             ` Eric W. Biederman
2007-12-18  4:51               ` H. Peter Anvin
2007-12-18  9:35               ` Andi Kleen
2007-12-18 13:48                 ` Eric W. Biederman
2007-12-14  0:43     ` Andi Kleen
2007-12-14  0:54   ` Jesse Barnes
2007-12-14  3:59   ` Eric W. Biederman
2007-12-14  6:02     ` Greg KH
2007-12-14  6:04       ` Eric W. Biederman
2007-12-14 10:19         ` Andi Kleen
2007-12-13 23:55 ` [RFC PATCH 09/12] PAT 64b: map only usable memory in identity mapping venkatesh.pallipadi
2007-12-13 23:55 ` [RFC PATCH 10/12] PAT 64b: Make acpi use early map instead of assuming identity map venkatesh.pallipadi
2007-12-13 23:55 ` [RFC PATCH 11/12] PAT 64b: devmem do not read pages not mapped in " venkatesh.pallipadi
2007-12-13 23:55 ` [RFC PATCH 12/12] PAT 64b: skip attr tracking for RAM venkatesh.pallipadi
2007-12-14  0:28 ` [RFC PATCH 00/12] PAT 64b: PAT support for X86_64 Dave Airlie
2007-12-14 22:00   ` Siddha, Suresh B
2007-12-14 22:27     ` Dave Airlie
2007-12-14 22:32       ` H. Peter Anvin
2007-12-14 22:37         ` Dave Airlie

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=m1fxy0be2u.fsf@ebiederm.dsl.xmission.com \
    --to=ebiederm@xmission.com \
    --cc=airlied@skynet.ie \
    --cc=ak@muc.de \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=davej@redhat.com \
    --cc=gregkh@suse.de \
    --cc=hpa@zytor.com \
    --cc=jesse.barnes@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rdreier@cisco.com \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=venkatesh.pallipadi@intel.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

Powered by JetHome