All of lore.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Zach Pfeffer <zpfeffer@codeaurora.org>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>,
	FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
	linux-arch@vger.kernel.org, dwalker@codeaurora.org,
	mel@csn.ul.ie, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	andi@firstfloor.org, linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC 1/3 v3] mm: iommu: An API to unify IOMMU, CPU and device memory management
Date: Mon, 19 Jul 2010 00:44:49 -0700	[thread overview]
Message-ID: <m1mxtndifi.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <20100719065233.GD11054@codeaurora.org> (Zach Pfeffer's message of "Sun\, 18 Jul 2010 23\:52\:33 -0700")

Zach Pfeffer <zpfeffer@codeaurora.org> writes:

> On Thu, Jul 15, 2010 at 09:55:35AM +0100, Russell King - ARM Linux wrote:
>> On Wed, Jul 14, 2010 at 06:29:58PM -0700, Zach Pfeffer wrote:
>> > The VCM ensures that all mappings that map a given physical buffer:
>> > IOMMU mappings, CPU mappings and one-to-one device mappings all map
>> > that buffer using the same (or compatible) attributes. At this point
>> > the only attribute that users can pass is CACHED. In the absence of
>> > CACHED all accesses go straight through to the physical memory.
>> 
>> So what you're saying is that if I have a buffer in kernel space
>> which I already have its virtual address, I can pass this to VCM and
>> tell it !CACHED, and it'll setup another mapping which is not cached
>> for me?
>
> Not quite. The existing mapping will be represented by a reservation
> from the prebuilt VCM of the VM. This reservation has been marked
> non-cached. Another reservation on a IOMMU VCM, also marked non-cached
> will be backed with the same physical memory. This is legal in ARM,
> allowing the vcm_back call to succeed. If you instead passed cached on
> the second mapping, the first mapping would be non-cached and the
> second would be cached. If the underlying architecture supported this
> than the vcm_back would go through.

How does this compare with the x86 pat code?

>> You are aware that multiple V:P mappings for the same physical page
>> with different attributes are being outlawed with ARMv6 and ARMv7
>> due to speculative prefetching.  The cache can be searched even for
>> a mapping specified as 'normal, uncached' and you can get cache hits
>> because the data has been speculatively loaded through a separate
>> cached mapping of the same physical page.
>
> I didn't know that. Thanks for the heads up.
>
>> FYI, during the next merge window, I will be pushing a patch which makes
>> ioremap() of system RAM fail, which should be the last core code creator
>> of mappings with different memory types.  This behaviour has been outlawed
>> (as unpredictable) in the architecture specification and does cause
>> problems on some CPUs.
>
> That's fair enough, but it seems like it should only be outlawed for
> those processors on which it breaks.

To my knowledge mismatch of mapping attributes is a problem on most
cpus on every architecture.  I don't see it making sense to encourage
coding constructs that will fail in the strangest most difficult to
debug ways.

Eric


WARNING: multiple messages have this Message-ID (diff)
From: ebiederm@xmission.com (Eric W. Biederman)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC 1/3 v3] mm: iommu: An API to unify IOMMU, CPU and device memory management
Date: Mon, 19 Jul 2010 00:44:49 -0700	[thread overview]
Message-ID: <m1mxtndifi.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <20100719065233.GD11054@codeaurora.org> (Zach Pfeffer's message of "Sun\, 18 Jul 2010 23\:52\:33 -0700")

Zach Pfeffer <zpfeffer@codeaurora.org> writes:

> On Thu, Jul 15, 2010 at 09:55:35AM +0100, Russell King - ARM Linux wrote:
>> On Wed, Jul 14, 2010 at 06:29:58PM -0700, Zach Pfeffer wrote:
>> > The VCM ensures that all mappings that map a given physical buffer:
>> > IOMMU mappings, CPU mappings and one-to-one device mappings all map
>> > that buffer using the same (or compatible) attributes. At this point
>> > the only attribute that users can pass is CACHED. In the absence of
>> > CACHED all accesses go straight through to the physical memory.
>> 
>> So what you're saying is that if I have a buffer in kernel space
>> which I already have its virtual address, I can pass this to VCM and
>> tell it !CACHED, and it'll setup another mapping which is not cached
>> for me?
>
> Not quite. The existing mapping will be represented by a reservation
> from the prebuilt VCM of the VM. This reservation has been marked
> non-cached. Another reservation on a IOMMU VCM, also marked non-cached
> will be backed with the same physical memory. This is legal in ARM,
> allowing the vcm_back call to succeed. If you instead passed cached on
> the second mapping, the first mapping would be non-cached and the
> second would be cached. If the underlying architecture supported this
> than the vcm_back would go through.

How does this compare with the x86 pat code?

>> You are aware that multiple V:P mappings for the same physical page
>> with different attributes are being outlawed with ARMv6 and ARMv7
>> due to speculative prefetching.  The cache can be searched even for
>> a mapping specified as 'normal, uncached' and you can get cache hits
>> because the data has been speculatively loaded through a separate
>> cached mapping of the same physical page.
>
> I didn't know that. Thanks for the heads up.
>
>> FYI, during the next merge window, I will be pushing a patch which makes
>> ioremap() of system RAM fail, which should be the last core code creator
>> of mappings with different memory types.  This behaviour has been outlawed
>> (as unpredictable) in the architecture specification and does cause
>> problems on some CPUs.
>
> That's fair enough, but it seems like it should only be outlawed for
> those processors on which it breaks.

To my knowledge mismatch of mapping attributes is a problem on most
cpus on every architecture.  I don't see it making sense to encourage
coding constructs that will fail in the strangest most difficult to
debug ways.

Eric

WARNING: multiple messages have this Message-ID (diff)
From: ebiederm@xmission.com (Eric W. Biederman)
To: Zach Pfeffer <zpfeffer@codeaurora.org>
Cc: Russell King - ARM Linux <linux@arm.linux.org.uk>,
	FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>,
	linux-arch@vger.kernel.org, dwalker@codeaurora.org,
	mel@csn.ul.ie, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	andi@firstfloor.org, linux-omap@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [RFC 1/3 v3] mm: iommu: An API to unify IOMMU, CPU and device memory management
Date: Mon, 19 Jul 2010 00:44:49 -0700	[thread overview]
Message-ID: <m1mxtndifi.fsf@fess.ebiederm.org> (raw)
In-Reply-To: <20100719065233.GD11054@codeaurora.org> (Zach Pfeffer's message of "Sun\, 18 Jul 2010 23\:52\:33 -0700")

Zach Pfeffer <zpfeffer@codeaurora.org> writes:

> On Thu, Jul 15, 2010 at 09:55:35AM +0100, Russell King - ARM Linux wrote:
>> On Wed, Jul 14, 2010 at 06:29:58PM -0700, Zach Pfeffer wrote:
>> > The VCM ensures that all mappings that map a given physical buffer:
>> > IOMMU mappings, CPU mappings and one-to-one device mappings all map
>> > that buffer using the same (or compatible) attributes. At this point
>> > the only attribute that users can pass is CACHED. In the absence of
>> > CACHED all accesses go straight through to the physical memory.
>> 
>> So what you're saying is that if I have a buffer in kernel space
>> which I already have its virtual address, I can pass this to VCM and
>> tell it !CACHED, and it'll setup another mapping which is not cached
>> for me?
>
> Not quite. The existing mapping will be represented by a reservation
> from the prebuilt VCM of the VM. This reservation has been marked
> non-cached. Another reservation on a IOMMU VCM, also marked non-cached
> will be backed with the same physical memory. This is legal in ARM,
> allowing the vcm_back call to succeed. If you instead passed cached on
> the second mapping, the first mapping would be non-cached and the
> second would be cached. If the underlying architecture supported this
> than the vcm_back would go through.

How does this compare with the x86 pat code?

>> You are aware that multiple V:P mappings for the same physical page
>> with different attributes are being outlawed with ARMv6 and ARMv7
>> due to speculative prefetching.  The cache can be searched even for
>> a mapping specified as 'normal, uncached' and you can get cache hits
>> because the data has been speculatively loaded through a separate
>> cached mapping of the same physical page.
>
> I didn't know that. Thanks for the heads up.
>
>> FYI, during the next merge window, I will be pushing a patch which makes
>> ioremap() of system RAM fail, which should be the last core code creator
>> of mappings with different memory types.  This behaviour has been outlawed
>> (as unpredictable) in the architecture specification and does cause
>> problems on some CPUs.
>
> That's fair enough, but it seems like it should only be outlawed for
> those processors on which it breaks.

To my knowledge mismatch of mapping attributes is a problem on most
cpus on every architecture.  I don't see it making sense to encourage
coding constructs that will fail in the strangest most difficult to
debug ways.

Eric

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2010-07-19  7:44 UTC|newest]

Thread overview: 163+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-03  5:38 [RFC 1/3 v3] mm: iommu: An API to unify IOMMU, CPU and device memory management Zach Pfeffer
2010-07-03  5:38 ` Zach Pfeffer
2010-07-03  5:38 ` Zach Pfeffer
2010-07-03 19:06 ` Eric W. Biederman
2010-07-03 19:06   ` Eric W. Biederman
2010-07-03 19:06   ` Eric W. Biederman
2010-07-07 22:44   ` Zach Pfeffer
2010-07-07 22:44     ` Zach Pfeffer
2010-07-07 22:44     ` Zach Pfeffer
2010-07-07 23:07     ` Russell King - ARM Linux
2010-07-07 23:07       ` Russell King - ARM Linux
2010-07-07 23:07       ` Russell King - ARM Linux
2010-07-08 23:59       ` Zach Pfeffer
2010-07-08 23:59         ` Zach Pfeffer
2010-07-08 23:59         ` Zach Pfeffer
2010-07-12  1:25         ` FUJITA Tomonori
2010-07-12  1:25           ` FUJITA Tomonori
2010-07-12  1:25           ` FUJITA Tomonori
2010-07-13  5:57           ` Zach Pfeffer
2010-07-13  5:57             ` Zach Pfeffer
2010-07-13  5:57             ` Zach Pfeffer
2010-07-13  6:03             ` FUJITA Tomonori
2010-07-13  6:03               ` FUJITA Tomonori
2010-07-13  6:03               ` FUJITA Tomonori
2010-07-13 12:14               ` Zach Pfeffer
2010-07-13 12:14                 ` Zach Pfeffer
2010-07-13 12:14                 ` Zach Pfeffer
2010-07-14  1:59                 ` FUJITA Tomonori
2010-07-14  1:59                   ` FUJITA Tomonori
2010-07-14  1:59                   ` FUJITA Tomonori
2010-07-14 20:11                   ` Zach Pfeffer
2010-07-14 20:11                     ` Zach Pfeffer
2010-07-14 20:11                     ` Zach Pfeffer
2010-07-14 22:05                     ` Russell King - ARM Linux
2010-07-14 22:05                       ` Russell King - ARM Linux
2010-07-14 22:05                       ` Russell King - ARM Linux
2010-07-15  1:29                       ` Zach Pfeffer
2010-07-15  1:29                         ` Zach Pfeffer
2010-07-15  1:29                         ` Zach Pfeffer
2010-07-15  1:47                         ` Eric W. Biederman
2010-07-15  1:47                           ` Eric W. Biederman
2010-07-15  1:47                           ` Eric W. Biederman
2010-07-15  5:40                           ` Zach Pfeffer
2010-07-15  5:40                             ` Zach Pfeffer
2010-07-15  5:40                             ` Zach Pfeffer
2010-07-15  5:35                         ` Zach Pfeffer
2010-07-15  5:35                           ` Zach Pfeffer
2010-07-15  5:35                           ` Zach Pfeffer
2010-07-15  8:55                         ` Russell King - ARM Linux
2010-07-15  8:55                           ` Russell King - ARM Linux
2010-07-15  8:55                           ` Russell King - ARM Linux
2010-07-16  0:48                           ` Tim HRM
2010-07-16  0:48                             ` Tim HRM
2010-07-16  0:48                             ` Tim HRM
2010-07-16  0:48                             ` Tim HRM
2010-07-16  7:58                             ` Russell King - ARM Linux
2010-07-16  7:58                               ` Russell King - ARM Linux
2010-07-16  7:58                               ` Russell King - ARM Linux
2010-07-17  0:01                               ` Larry Bassel
2010-07-17  0:01                                 ` Larry Bassel
2010-07-17  0:01                                 ` Larry Bassel
2010-07-19  9:21                                 ` Tim HRM
2010-07-19  9:21                                   ` Tim HRM
2010-07-19  9:21                                   ` Tim HRM
2010-07-19  9:21                                   ` Tim HRM
2010-07-21  0:44                                   ` Zach Pfeffer
2010-07-21  0:44                                     ` Zach Pfeffer
2010-07-21  0:44                                     ` Zach Pfeffer
2010-07-21  1:44                                     ` Timothy Meade
2010-07-21  1:44                                       ` Timothy Meade
2010-07-21  1:44                                       ` Timothy Meade
2010-07-21  1:44                                       ` Timothy Meade
2010-07-22  4:06                                       ` Zach Pfeffer
2010-07-22  4:06                                         ` Zach Pfeffer
2010-07-22  4:06                                         ` Zach Pfeffer
2010-07-19 17:55                               ` Michael Bohan
2010-07-19 17:55                                 ` Michael Bohan
2010-07-19 17:55                                 ` Michael Bohan
2010-07-19 18:40                                 ` Russell King - ARM Linux
2010-07-19 18:40                                   ` Russell King - ARM Linux
2010-07-19 18:40                                   ` Russell King - ARM Linux
2010-07-20 22:02                                   ` stepanm
2010-07-20 22:02                                     ` stepanm at codeaurora.org
2010-07-20 22:02                                     ` stepanm
2010-07-20 22:29                                     ` Russell King - ARM Linux
2010-07-20 22:29                                       ` Russell King - ARM Linux
2010-07-20 22:29                                       ` Russell King - ARM Linux
2010-07-21  5:49                                       ` Shilimkar, Santosh
2010-07-21  5:49                                         ` Shilimkar, Santosh
2010-07-21  5:49                                         ` Shilimkar, Santosh
2010-07-21  7:28                                         ` Russell King - ARM Linux
2010-07-21  7:28                                           ` Russell King - ARM Linux
2010-07-21  7:28                                           ` Russell King - ARM Linux
2010-07-21  7:45                                           ` Shilimkar, Santosh
2010-07-21  7:45                                             ` Shilimkar, Santosh
2010-07-21  7:45                                             ` Shilimkar, Santosh
2010-07-21 18:04                                           ` stepanm
2010-07-21 18:04                                             ` stepanm at codeaurora.org
2010-07-21 18:04                                             ` stepanm
2010-07-20 20:45                               ` Zach Pfeffer
2010-07-20 20:45                                 ` Zach Pfeffer
2010-07-20 20:45                                 ` Zach Pfeffer
2010-07-20 20:54                                 ` Russell King - ARM Linux
2010-07-20 20:54                                   ` Russell King - ARM Linux
2010-07-20 20:54                                   ` Russell King - ARM Linux
2010-07-20 21:56                                   ` Zach Pfeffer
2010-07-20 21:56                                     ` Zach Pfeffer
2010-07-20 21:56                                     ` Zach Pfeffer
2010-07-19  6:52                           ` Zach Pfeffer
2010-07-19  6:52                             ` Zach Pfeffer
2010-07-19  6:52                             ` Zach Pfeffer
2010-07-19  7:44                             ` Eric W. Biederman [this message]
2010-07-19  7:44                               ` Eric W. Biederman
2010-07-19  7:44                               ` Eric W. Biederman
2010-07-22  4:25                               ` Zach Pfeffer
2010-07-22  4:25                                 ` Zach Pfeffer
2010-07-22  4:25                                 ` Zach Pfeffer
2010-07-22  7:34                                 ` Russell King - ARM Linux
2010-07-22  7:34                                   ` Russell King - ARM Linux
2010-07-22  7:34                                   ` Russell King - ARM Linux
2010-07-22 16:25                                   ` Zach Pfeffer
2010-07-22 16:25                                     ` Zach Pfeffer
2010-07-22 16:25                                     ` Zach Pfeffer
2010-07-14 23:07                     ` FUJITA Tomonori
2010-07-14 23:07                       ` FUJITA Tomonori
2010-07-14 23:07                       ` FUJITA Tomonori
2010-07-15  1:41                       ` Zach Pfeffer
2010-07-15  1:41                         ` Zach Pfeffer
2010-07-15  1:41                         ` Zach Pfeffer
2010-07-19  8:22                         ` Russell King - ARM Linux
2010-07-19  8:22                           ` Russell King - ARM Linux
2010-07-19  8:22                           ` Russell King - ARM Linux
2010-07-20 10:09                           ` FUJITA Tomonori
2010-07-20 10:09                             ` FUJITA Tomonori
2010-07-20 10:09                             ` FUJITA Tomonori
2010-07-20 22:20                           ` Zach Pfeffer
2010-07-20 22:20                             ` Zach Pfeffer
2010-07-20 22:20                             ` Zach Pfeffer
2010-07-21  1:44                             ` FUJITA Tomonori
2010-07-21  1:44                               ` FUJITA Tomonori
2010-07-21  1:44                               ` FUJITA Tomonori
2010-07-22  4:30                               ` Zach Pfeffer
2010-07-22  4:30                                 ` Zach Pfeffer
2010-07-22  4:30                                 ` Zach Pfeffer
2010-07-22  4:43                                 ` FUJITA Tomonori
2010-07-22  4:43                                   ` FUJITA Tomonori
2010-07-22  4:43                                   ` FUJITA Tomonori
2010-07-22 16:44                                   ` Zach Pfeffer
2010-07-22 16:44                                     ` Zach Pfeffer
2010-07-22 16:44                                     ` Zach Pfeffer
2010-07-22  7:39                                 ` Russell King - ARM Linux
2010-07-22  7:39                                   ` Russell King - ARM Linux
2010-07-22  7:39                                   ` Russell King - ARM Linux
2010-07-22 16:28                                   ` Zach Pfeffer
2010-07-22 16:28                                     ` Zach Pfeffer
2010-07-22 16:28                                     ` Zach Pfeffer
  -- strict thread matches above, loose matches on Subject: below --
2010-07-06 15:42 Zach Pfeffer
2010-07-06 15:42 ` Zach Pfeffer
2010-07-21  5:18 stepanm
2010-07-21  5:18 ` stepanm
2010-07-21  5:18 ` stepanm
2010-07-21  5:18 ` stepanm at codeaurora.org
2010-07-21  5:18 ` stepanm

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=m1mxtndifi.fsf@fess.ebiederm.org \
    --to=ebiederm@xmission.com \
    --cc=andi@firstfloor.org \
    --cc=dwalker@codeaurora.org \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=mel@csn.ul.ie \
    --cc=zpfeffer@codeaurora.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.