From: Russell King - ARM Linux <hidden> Date: 2011-01-23 14:56:39
On Sun, Jan 23, 2011 at 04:38:01PM +0200, saeed bishara wrote:
Hi,
I've port 2.6.35 to SMP system that runs in V6 mode, this system
doesn't support TLB operations broadcasting by hw, so it uses IPI
messages for that. when enabling DEBUG_LOCKDEP, I got the following
error message while booting the system from NFS:
You've bypassed this check:
if (is_smp() && tlb_ops_need_broadcast()) {
/*
* kmap_high needs to occasionally flush TLB entries,
* however, if the TLB entries need to be broadcast
* we may deadlock:
* kmap_high(irqs off)->flush_all_zero_pkmaps->
* flush_tlb_kernel_range->smp_call_function_many
* (must not be called with irqs off)
*/
reason = "without hardware TLB ops broadcasting";
}
so you lose. There's reasons why such checks are put in. We can not
support SMP and highmem on systems which do not have TLB broadcasting.
That's not because the code doesn't support it, it's because there are
deadlocks which will occur.
The fact is that it is unsafe to send IPIs with IRQs disabled, which
means you can't IPI a TLB operation and wait for it to complete with IRQs
disabled.
The kmap code sets up and tears down mappings with IRQs disabled because
of the need to work with the DMA API. This means that it when it wants
to do a TLB operation (to flush out old mappings) its calling context is
incompatible with what's required to broadcast that operation in
software.
There is no solution to this. SMP without hardware TLB broadcast is
incompatible with the requirements of highmem.
On Sun, Jan 23, 2011 at 4:56 PM, Russell King - ARM Linux
[off-list ref] wrote:
On Sun, Jan 23, 2011 at 04:38:01PM +0200, saeed bishara wrote:
quoted
Hi,
I've port 2.6.35 to SMP system that runs in V6 mode, this system
doesn't support TLB operations broadcasting by hw, so it uses IPI
messages for that. ?when enabling DEBUG_LOCKDEP, I got the following
error message while booting the system from NFS:
You've bypassed this check:
? ? ? ? ? ? ? ?if (is_smp() && tlb_ops_need_broadcast()) {
? ? ? ? ? ? ? ? ? ? ? ?/*
? ? ? ? ? ? ? ? ? ? ? ? * kmap_high needs to occasionally flush TLB entries,
? ? ? ? ? ? ? ? ? ? ? ? * however, if the TLB entries need to be broadcast
? ? ? ? ? ? ? ? ? ? ? ? * we may deadlock:
? ? ? ? ? ? ? ? ? ? ? ? * ?kmap_high(irqs off)->flush_all_zero_pkmaps->
? ? ? ? ? ? ? ? ? ? ? ? * ?flush_tlb_kernel_range->smp_call_function_many
? ? ? ? ? ? ? ? ? ? ? ? * ? (must not be called with irqs off)
? ? ? ? ? ? ? ? ? ? ? ? */
? ? ? ? ? ? ? ? ? ? ? ?reason = "without hardware TLB ops broadcasting";
? ? ? ? ? ? ? ?}
so you lose. ?There's reasons why such checks are put in. ?We can not
support SMP and highmem on systems which do not have TLB broadcasting.
That's not because the code doesn't support it, it's because there are
deadlocks which will occur.
thanks, I missed that
The fact is that it is unsafe to send IPIs with IRQs disabled, which
means you can't IPI a TLB operation and wait for it to complete with IRQs
disabled.
as I understand it, the lock_kmap() started to disable IRQs in order
to support the vivt and vipt caches, but in SMP (at least in my case),
the caches are PIPT, so I think I can do the following:
1. undef the ARCH_NEEDS_KMAP_HIGH_GET
2. use page_address instead of kmap_high_get()
do you think it will work?
saeed
The kmap code sets up and tears down mappings with IRQs disabled because
of the need to work with the DMA API. ?This means that it when it wants
to do a TLB operation (to flush out old mappings) its calling context is
incompatible with what's required to broadcast that operation in
software.
There is no solution to this. ?SMP without hardware TLB broadcast is
incompatible with the requirements of highmem.
From: Russell King - ARM Linux <hidden> Date: 2011-01-23 17:08:30
On Sun, Jan 23, 2011 at 06:34:24PM +0200, saeed bishara wrote:
On Sun, Jan 23, 2011 at 4:56 PM, Russell King - ARM Linux
[off-list ref] wrote:
quoted
On Sun, Jan 23, 2011 at 04:38:01PM +0200, saeed bishara wrote:
quoted
Hi,
I've port 2.6.35 to SMP system that runs in V6 mode, this system
doesn't support TLB operations broadcasting by hw, so it uses IPI
messages for that. ?when enabling DEBUG_LOCKDEP, I got the following
error message while booting the system from NFS:
You've bypassed this check:
? ? ? ? ? ? ? ?if (is_smp() && tlb_ops_need_broadcast()) {
? ? ? ? ? ? ? ? ? ? ? ?/*
? ? ? ? ? ? ? ? ? ? ? ? * kmap_high needs to occasionally flush TLB entries,
? ? ? ? ? ? ? ? ? ? ? ? * however, if the TLB entries need to be broadcast
? ? ? ? ? ? ? ? ? ? ? ? * we may deadlock:
? ? ? ? ? ? ? ? ? ? ? ? * ?kmap_high(irqs off)->flush_all_zero_pkmaps->
? ? ? ? ? ? ? ? ? ? ? ? * ?flush_tlb_kernel_range->smp_call_function_many
? ? ? ? ? ? ? ? ? ? ? ? * ? (must not be called with irqs off)
? ? ? ? ? ? ? ? ? ? ? ? */
? ? ? ? ? ? ? ? ? ? ? ?reason = "without hardware TLB ops broadcasting";
? ? ? ? ? ? ? ?}
so you lose. ?There's reasons why such checks are put in. ?We can not
support SMP and highmem on systems which do not have TLB broadcasting.
That's not because the code doesn't support it, it's because there are
deadlocks which will occur.
thanks, I missed that
quoted
The fact is that it is unsafe to send IPIs with IRQs disabled, which
means you can't IPI a TLB operation and wait for it to complete with IRQs
disabled.
as I understand it, the lock_kmap() started to disable IRQs in order
to support the vivt and vipt caches, but in SMP (at least in my case),
the caches are PIPT, so I think I can do the following:
1. undef the ARCH_NEEDS_KMAP_HIGH_GET
2. use page_address instead of kmap_high_get()
do you think it will work?
Definitely not. We use kmap_high_get() so that we can ensure that we've
flushed data out of the PIPT cache for highmem pages. highmem pages
which are unmapped do not have a valid page_address() but may have PIPT
cache lines associated with them.
So no, I don't think it'll be safe.
I've port 2.6.35 to SMP system that runs in V6 mode, this system
doesn't support TLB operations broadcasting by hw, so it uses IPI
messages for that. ?when enabling DEBUG_LOCKDEP, I got the following
error message while booting the system from NFS:
You've bypassed this check:
? ? ? ? ? ? ? ?if (is_smp() && tlb_ops_need_broadcast()) {
? ? ? ? ? ? ? ? ? ? ? ?/*
? ? ? ? ? ? ? ? ? ? ? ? * kmap_high needs to occasionally flush TLB entries,
? ? ? ? ? ? ? ? ? ? ? ? * however, if the TLB entries need to be broadcast
? ? ? ? ? ? ? ? ? ? ? ? * we may deadlock:
? ? ? ? ? ? ? ? ? ? ? ? * ?kmap_high(irqs off)->flush_all_zero_pkmaps->
? ? ? ? ? ? ? ? ? ? ? ? * ?flush_tlb_kernel_range->smp_call_function_many
? ? ? ? ? ? ? ? ? ? ? ? * ? (must not be called with irqs off)
? ? ? ? ? ? ? ? ? ? ? ? */
? ? ? ? ? ? ? ? ? ? ? ?reason = "without hardware TLB ops broadcasting";
? ? ? ? ? ? ? ?}
so you lose. ?There's reasons why such checks are put in. ?We can not
support SMP and highmem on systems which do not have TLB broadcasting.
That's not because the code doesn't support it, it's because there are
deadlocks which will occur.
thanks, I missed that
quoted
The fact is that it is unsafe to send IPIs with IRQs disabled, which
means you can't IPI a TLB operation and wait for it to complete with IRQs
disabled.
as I understand it, the lock_kmap() started to disable IRQs in order
to support the vivt and vipt caches, but in SMP (at least in my case),
the caches are PIPT, so I think I can do the following:
1. undef ?the ?ARCH_NEEDS_KMAP_HIGH_GET
2. use page_address instead of kmap_high_get()
do you think it will work?
Definitely not. ?We use kmap_high_get() so that we can ensure that we've
flushed data out of the PIPT cache for highmem pages. ?highmem pages
which are unmapped do not have a valid page_address() but may have PIPT
cache lines associated with them.
So no, I don't think it'll be safe.
ok, what about the following patch, the idea is to use only the
kmap_high_l1_vipt when doing cache maintenance.
From: Russell King - ARM Linux <hidden> Date: 2011-01-24 09:19:57
On Mon, Jan 24, 2011 at 10:47:36AM +0200, saeed bishara wrote:
quoted
quoted
quoted
quoted
I've port 2.6.35 to SMP system that runs in V6 mode, this system
doesn't support TLB operations broadcasting by hw, so it uses IPI
messages for that. ?when enabling DEBUG_LOCKDEP, I got the following
error message while booting the system from NFS:
You've bypassed this check:
? ? ? ? ? ? ? ?if (is_smp() && tlb_ops_need_broadcast()) {
? ? ? ? ? ? ? ? ? ? ? ?/*
? ? ? ? ? ? ? ? ? ? ? ? * kmap_high needs to occasionally flush TLB entries,
? ? ? ? ? ? ? ? ? ? ? ? * however, if the TLB entries need to be broadcast
? ? ? ? ? ? ? ? ? ? ? ? * we may deadlock:
? ? ? ? ? ? ? ? ? ? ? ? * ?kmap_high(irqs off)->flush_all_zero_pkmaps->
? ? ? ? ? ? ? ? ? ? ? ? * ?flush_tlb_kernel_range->smp_call_function_many
? ? ? ? ? ? ? ? ? ? ? ? * ? (must not be called with irqs off)
? ? ? ? ? ? ? ? ? ? ? ? */
? ? ? ? ? ? ? ? ? ? ? ?reason = "without hardware TLB ops broadcasting";
? ? ? ? ? ? ? ?}
so you lose. ?There's reasons why such checks are put in. ?We can not
support SMP and highmem on systems which do not have TLB broadcasting.
That's not because the code doesn't support it, it's because there are
deadlocks which will occur.
thanks, I missed that
quoted
The fact is that it is unsafe to send IPIs with IRQs disabled, which
means you can't IPI a TLB operation and wait for it to complete with IRQs
disabled.
as I understand it, the lock_kmap() started to disable IRQs in order
to support the vivt and vipt caches, but in SMP (at least in my case),
the caches are PIPT, so I think I can do the following:
1. undef ?the ?ARCH_NEEDS_KMAP_HIGH_GET
2. use page_address instead of kmap_high_get()
do you think it will work?
Definitely not. ?We use kmap_high_get() so that we can ensure that we've
flushed data out of the PIPT cache for highmem pages. ?highmem pages
which are unmapped do not have a valid page_address() but may have PIPT
cache lines associated with them.
So no, I don't think it'll be safe.
ok, what about the following patch, the idea is to use only the
kmap_high_l1_vipt when doing cache maintenance.
*page, unsigned long offset,
}
len = PAGE_SIZE - offset;
}
+#ifdef ARCH_NEEDS_KMAP_HIGH_GET
vaddr = kmap_high_get(page);
if (vaddr) {
vaddr += offset;
op(vaddr, len, dir);
kunmap_high(page);
- } else if (cache_is_vipt()) {
+ } else if (cache_is_vipt())
+#endif
So you're disabling DMA cache maintainence, making DMA support *unsafe*
on your platform. You'll get filesystem corruption and other crap like
that. Maybe you don't care for users data?
I suggest you read the commit comments in 7e5a69e83.
Not only that but this can lead to I/D cache incoherency, leading to
segfaults and illegal instruction exceptions from userspace programs.
So I doubt you'll be able to get this to work reliably, even if you
disabled all DMA support for your platform.
I really think you're wasting your time.
On Mon, Jan 24, 2011 at 11:19 AM, Russell King - ARM Linux
[off-list ref] wrote:
On Mon, Jan 24, 2011 at 10:47:36AM +0200, saeed bishara wrote:
quoted
quoted
quoted
quoted
quoted
I've port 2.6.35 to SMP system that runs in V6 mode, this system
doesn't support TLB operations broadcasting by hw, so it uses IPI
messages for that. ?when enabling DEBUG_LOCKDEP, I got the following
error message while booting the system from NFS:
You've bypassed this check:
? ? ? ? ? ? ? ?if (is_smp() && tlb_ops_need_broadcast()) {
? ? ? ? ? ? ? ? ? ? ? ?/*
? ? ? ? ? ? ? ? ? ? ? ? * kmap_high needs to occasionally flush TLB entries,
? ? ? ? ? ? ? ? ? ? ? ? * however, if the TLB entries need to be broadcast
? ? ? ? ? ? ? ? ? ? ? ? * we may deadlock:
? ? ? ? ? ? ? ? ? ? ? ? * ?kmap_high(irqs off)->flush_all_zero_pkmaps->
? ? ? ? ? ? ? ? ? ? ? ? * ?flush_tlb_kernel_range->smp_call_function_many
? ? ? ? ? ? ? ? ? ? ? ? * ? (must not be called with irqs off)
? ? ? ? ? ? ? ? ? ? ? ? */
? ? ? ? ? ? ? ? ? ? ? ?reason = "without hardware TLB ops broadcasting";
? ? ? ? ? ? ? ?}
so you lose. ?There's reasons why such checks are put in. ?We can not
support SMP and highmem on systems which do not have TLB broadcasting.
That's not because the code doesn't support it, it's because there are
deadlocks which will occur.
thanks, I missed that
quoted
The fact is that it is unsafe to send IPIs with IRQs disabled, which
means you can't IPI a TLB operation and wait for it to complete with IRQs
disabled.
as I understand it, the lock_kmap() started to disable IRQs in order
to support the vivt and vipt caches, but in SMP (at least in my case),
the caches are PIPT, so I think I can do the following:
1. undef ?the ?ARCH_NEEDS_KMAP_HIGH_GET
2. use page_address instead of kmap_high_get()
do you think it will work?
Definitely not. ?We use kmap_high_get() so that we can ensure that we've
flushed data out of the PIPT cache for highmem pages. ?highmem pages
which are unmapped do not have a valid page_address() but may have PIPT
cache lines associated with them.
So no, I don't think it'll be safe.
ok, what about the following patch, the idea is to use only the
kmap_high_l1_vipt when doing cache maintenance.
So you're disabling DMA cache maintainence, making DMA support *unsafe*
on your platform. ?You'll get filesystem corruption and other crap like
that. ?Maybe you don't care for users data?
no I'm not disabling DMA cache maintenance, this is how the code looks like:
#ifdef ARCH_NEEDS_KMAP_HIGH_GET
vaddr = kmap_high_get(page);
if (vaddr) {
vaddr += offset;
op(vaddr, len, dir);
kunmap_high(page);
} else if (cache_is_vipt())
#endif
{
pte_t saved_pte;
vaddr = kmap_high_l1_vipt(page, &saved_pte);
op(vaddr + offset, len, dir);
kunmap_high_l1_vipt(page, saved_pte);
}
so I'm doing that cache maintenance using new mapping by kmap_high_l1_vipt.
saeed
I've port 2.6.35 to SMP system that runs in V6 mode, this system
doesn't support TLB operations broadcasting by hw, so it uses IPI
messages for that. ?when enabling DEBUG_LOCKDEP, I got the following
error message while booting the system from NFS:
You've bypassed this check:
? ? ? ? ? ? ? ?if (is_smp() && tlb_ops_need_broadcast()) {
? ? ? ? ? ? ? ? ? ? ? ?/*
? ? ? ? ? ? ? ? ? ? ? ? * kmap_high needs to occasionally flush TLB entries,
? ? ? ? ? ? ? ? ? ? ? ? * however, if the TLB entries need to be broadcast
? ? ? ? ? ? ? ? ? ? ? ? * we may deadlock:
? ? ? ? ? ? ? ? ? ? ? ? * ?kmap_high(irqs off)->flush_all_zero_pkmaps->
? ? ? ? ? ? ? ? ? ? ? ? * ?flush_tlb_kernel_range->smp_call_function_many
? ? ? ? ? ? ? ? ? ? ? ? * ? (must not be called with irqs off)
? ? ? ? ? ? ? ? ? ? ? ? */
? ? ? ? ? ? ? ? ? ? ? ?reason = "without hardware TLB ops broadcasting";
? ? ? ? ? ? ? ?}
so you lose. ?There's reasons why such checks are put in. ?We can not
support SMP and highmem on systems which do not have TLB broadcasting.
That's not because the code doesn't support it, it's because there are
deadlocks which will occur.
thanks, I missed that
quoted
The fact is that it is unsafe to send IPIs with IRQs disabled, which
means you can't IPI a TLB operation and wait for it to complete with IRQs
disabled.
as I understand it, the lock_kmap() started to disable IRQs in order
to support the vivt and vipt caches, but in SMP (at least in my case),
the caches are PIPT, so I think I can do the following:
1. undef ?the ?ARCH_NEEDS_KMAP_HIGH_GET
2. use page_address instead of kmap_high_get()
do you think it will work?
Definitely not. ?We use kmap_high_get() so that we can ensure that we've
flushed data out of the PIPT cache for highmem pages. ?highmem pages
which are unmapped do not have a valid page_address() but may have PIPT
cache lines associated with them.
So no, I don't think it'll be safe.
ok, what about the following patch, the idea is to use only the
kmap_high_l1_vipt when doing cache maintenance.
This looks like it should work.
The reason for kmap_high_get() is to ensure that the currently kmap'd
page usage count does not decrease to zero while we're using its
existing virtual mapping in an atomic context. With a VIVT cache this
is essential to do, but with a VIPT cache this is only an optimization
so not to pay the price of establishing a second mapping if an existing
one can be used.
However your patch is ugly. I'd suggest the following instead:
@@ -19,13 +19,37 @@externpte_t*pkmap_page_table;-#define ARCH_NEEDS_KMAP_HIGH_GET-externvoid*kmap_high(structpage*page);-externvoid*kmap_high_get(structpage*page);externvoidkunmap_high(structpage*page);/*+*Thereasonforkmap_high_get()istoensurethatthecurrentlykmap'd+*pageusagecountdoesnotdecreasetozerowhilewe'reusingits+*existingvirtualmappinginanatomiccontext.WithaVIVTcachethis+*isessentialtodo,butwithaVIPTcachethisisonlyanoptimization+*sonottopaythepriceofestablishingasecondmappingifanexisting+*onecanbeused.However,onplatformswithouthardwareTLBmaintainence+*broadcast,wesimplycannotuseARCH_NEEDS_KMAP_HIGH_GETatallsince+*thelockinginvolvedmustalsodisableIRQswhichisincompatiblewith+*theIPImechanismusedbyglobalTLBoperations.+*/+#define ARCH_NEEDS_KMAP_HIGH_GET+#if defined(CONFIG_SMP) && defined(CONFIG_CPU_TLB_V6)+#undef ARCH_NEEDS_KMAP_HIGH_GET+#if defined(CONFIG_HIGHMEM) && defined(CONFIG_CPU_CACHE_VIVT)+#error "The sum of feature in your kernel config cannot be supported together"+#endif++#ifdef ARCH_NEEDS_KMAP_HIGH_GET+externvoid*kmap_high_get(structpage*page);+#else+staticinlinevoid*kmap_high_get(structpage*page)+{+returnNULL;+}+#endif++/**Thefollowingfunctionsarealreadydefinedby<linux/highmem.h>*whenCONFIG_HIGHMEMisnotset.*/
On Mon, Jan 24, 2011 at 9:58 PM, Nicolas Pitre [off-list ref] wrote:
quoted hunk
On Mon, 24 Jan 2011, saeed bishara wrote:
quoted
quoted
quoted
quoted
quoted
I've port 2.6.35 to SMP system that runs in V6 mode, this system
doesn't support TLB operations broadcasting by hw, so it uses IPI
messages for that. ?when enabling DEBUG_LOCKDEP, I got the following
error message while booting the system from NFS:
You've bypassed this check:
? ? ? ? ? ? ? ?if (is_smp() && tlb_ops_need_broadcast()) {
? ? ? ? ? ? ? ? ? ? ? ?/*
? ? ? ? ? ? ? ? ? ? ? ? * kmap_high needs to occasionally flush TLB entries,
? ? ? ? ? ? ? ? ? ? ? ? * however, if the TLB entries need to be broadcast
? ? ? ? ? ? ? ? ? ? ? ? * we may deadlock:
? ? ? ? ? ? ? ? ? ? ? ? * ?kmap_high(irqs off)->flush_all_zero_pkmaps->
? ? ? ? ? ? ? ? ? ? ? ? * ?flush_tlb_kernel_range->smp_call_function_many
? ? ? ? ? ? ? ? ? ? ? ? * ? (must not be called with irqs off)
? ? ? ? ? ? ? ? ? ? ? ? */
? ? ? ? ? ? ? ? ? ? ? ?reason = "without hardware TLB ops broadcasting";
? ? ? ? ? ? ? ?}
so you lose. ?There's reasons why such checks are put in. ?We can not
support SMP and highmem on systems which do not have TLB broadcasting.
That's not because the code doesn't support it, it's because there are
deadlocks which will occur.
thanks, I missed that
quoted
The fact is that it is unsafe to send IPIs with IRQs disabled, which
means you can't IPI a TLB operation and wait for it to complete with IRQs
disabled.
as I understand it, the lock_kmap() started to disable IRQs in order
to support the vivt and vipt caches, but in SMP (at least in my case),
the caches are PIPT, so I think I can do the following:
1. undef ?the ?ARCH_NEEDS_KMAP_HIGH_GET
2. use page_address instead of kmap_high_get()
do you think it will work?
Definitely not. ?We use kmap_high_get() so that we can ensure that we've
flushed data out of the PIPT cache for highmem pages. ?highmem pages
which are unmapped do not have a valid page_address() but may have PIPT
cache lines associated with them.
So no, I don't think it'll be safe.
ok, what about the following patch, the idea is to use only the
kmap_high_l1_vipt when doing cache maintenance.
This looks like it should work.
The reason for kmap_high_get() is to ensure that the currently kmap'd
page usage count does not decrease to zero while we're using its
existing virtual mapping in an atomic context. ?With a VIVT cache this
is essential to do, but with a VIPT cache this is only an optimization
so not to pay the price of establishing a second mapping if an existing
one can be used.
However your patch is ugly. ?I'd suggest the following instead:
?extern pte_t *pkmap_page_table;
-#define ARCH_NEEDS_KMAP_HIGH_GET
-
?extern void *kmap_high(struct page *page);
-extern void *kmap_high_get(struct page *page);
?extern void kunmap_high(struct page *page);
?/*
+ * The reason for kmap_high_get() is to ensure that the currently kmap'd
+ * page usage count does not decrease to zero while we're using its
+ * existing virtual mapping in an atomic context. ?With a VIVT cache this
+ * is essential to do, but with a VIPT cache this is only an optimization
+ * so not to pay the price of establishing a second mapping if an existing
+ * one can be used. ?However, on platforms without hardware TLB maintainence
+ * broadcast, we simply cannot use ARCH_NEEDS_KMAP_HIGH_GET at all since
+ * the locking involved must also disable IRQs which is incompatible with
+ * the IPI mechanism used by global TLB operations.
+ */
+#define ARCH_NEEDS_KMAP_HIGH_GET
+#if defined(CONFIG_SMP) && defined(CONFIG_CPU_TLB_V6)
+#undef ARCH_NEEDS_KMAP_HIGH_GET
+#if defined(CONFIG_HIGHMEM) && defined(CONFIG_CPU_CACHE_VIVT)
+#error "The sum of feature in your kernel config cannot be supported together"
+#endif
#endif is missing here.
quoted hunk
+
+#ifdef ARCH_NEEDS_KMAP_HIGH_GET
+extern void *kmap_high_get(struct page *page);
+#else
+static inline void *kmap_high_get(struct page *page)
+{
+ ? ? ? return NULL;
+}
+#endif
+
+/*
?* The following functions are already defined by <linux/highmem.h>
?* when CONFIG_HIGHMEM is not set.
?*/
From: Russell King - ARM Linux <hidden> Date: 2011-01-27 17:37:16
On Mon, Jan 24, 2011 at 02:58:07PM -0500, Nicolas Pitre wrote:
/*
+ * The reason for kmap_high_get() is to ensure that the currently kmap'd
+ * page usage count does not decrease to zero while we're using its
+ * existing virtual mapping in an atomic context. With a VIVT cache this
+ * is essential to do, but with a VIPT cache this is only an optimization
+ * so not to pay the price of establishing a second mapping if an existing
+ * one can be used. However, on platforms without hardware TLB maintainence
+ * broadcast, we simply cannot use ARCH_NEEDS_KMAP_HIGH_GET at all since
+ * the locking involved must also disable IRQs which is incompatible with
+ * the IPI mechanism used by global TLB operations.
+ */
+#define ARCH_NEEDS_KMAP_HIGH_GET
+#if defined(CONFIG_SMP) && defined(CONFIG_CPU_TLB_V6)
+#undef ARCH_NEEDS_KMAP_HIGH_GET
+#if defined(CONFIG_HIGHMEM) && defined(CONFIG_CPU_CACHE_VIVT)
+#error "The sum of feature in your kernel config cannot be supported together"
+#endif
This is wrong. Take a moment to consider a kernel supporting an ARMv6
VIPT aliasing cache CPU and ARMv7 SMP. Don't we need kmap_high_get()
for ARMv6 VIPT aliasing cache?
The effect of this is that dma_cache_maint_page() will create new mappings
which could be have the wrong colour - and therefore the subsequent cache
maintainence will not have the desired effect.
I think this may break OMAP.
On Thu, 27 Jan 2011, Russell King - ARM Linux wrote:
On Mon, Jan 24, 2011 at 02:58:07PM -0500, Nicolas Pitre wrote:
quoted
/*
+ * The reason for kmap_high_get() is to ensure that the currently kmap'd
+ * page usage count does not decrease to zero while we're using its
+ * existing virtual mapping in an atomic context. With a VIVT cache this
+ * is essential to do, but with a VIPT cache this is only an optimization
+ * so not to pay the price of establishing a second mapping if an existing
+ * one can be used. However, on platforms without hardware TLB maintainence
+ * broadcast, we simply cannot use ARCH_NEEDS_KMAP_HIGH_GET at all since
+ * the locking involved must also disable IRQs which is incompatible with
+ * the IPI mechanism used by global TLB operations.
+ */
+#define ARCH_NEEDS_KMAP_HIGH_GET
+#if defined(CONFIG_SMP) && defined(CONFIG_CPU_TLB_V6)
+#undef ARCH_NEEDS_KMAP_HIGH_GET
+#if defined(CONFIG_HIGHMEM) && defined(CONFIG_CPU_CACHE_VIVT)
+#error "The sum of feature in your kernel config cannot be supported together"
+#endif
This is wrong. Take a moment to consider a kernel supporting an ARMv6
VIPT aliasing cache CPU and ARMv7 SMP. Don't we need kmap_high_get()
for ARMv6 VIPT aliasing cache?
We don't support highmem on aliasing VIPT. Highmem gets disabled at run
time on aliasing VIPT platforms.
Nicolas
From: Russell King - ARM Linux <hidden> Date: 2011-01-27 19:04:11
On Thu, Jan 27, 2011 at 01:40:37PM -0500, Nicolas Pitre wrote:
On Thu, 27 Jan 2011, Russell King - ARM Linux wrote:
quoted
On Mon, Jan 24, 2011 at 02:58:07PM -0500, Nicolas Pitre wrote:
quoted
/*
+ * The reason for kmap_high_get() is to ensure that the currently kmap'd
+ * page usage count does not decrease to zero while we're using its
+ * existing virtual mapping in an atomic context. With a VIVT cache this
+ * is essential to do, but with a VIPT cache this is only an optimization
+ * so not to pay the price of establishing a second mapping if an existing
+ * one can be used. However, on platforms without hardware TLB maintainence
+ * broadcast, we simply cannot use ARCH_NEEDS_KMAP_HIGH_GET at all since
+ * the locking involved must also disable IRQs which is incompatible with
+ * the IPI mechanism used by global TLB operations.
+ */
+#define ARCH_NEEDS_KMAP_HIGH_GET
+#if defined(CONFIG_SMP) && defined(CONFIG_CPU_TLB_V6)
+#undef ARCH_NEEDS_KMAP_HIGH_GET
+#if defined(CONFIG_HIGHMEM) && defined(CONFIG_CPU_CACHE_VIVT)
+#error "The sum of feature in your kernel config cannot be supported together"
+#endif
This is wrong. Take a moment to consider a kernel supporting an ARMv6
VIPT aliasing cache CPU and ARMv7 SMP. Don't we need kmap_high_get()
for ARMv6 VIPT aliasing cache?
We don't support highmem on aliasing VIPT. Highmem gets disabled at run
time on aliasing VIPT platforms.
Correct. But a kernel which has this configuration:
CONFIG_SMP=y
CONFIG_HIGHMEM=y
CONFIG_CPU_V6=y
CONFIG_CPU_V7=y
CONFIG_CPU_32v6=y
CONFIG_CPU_32v7=y
CONFIG_CPU_CACHE_V6=y
CONFIG_CPU_CACHE_VIPT=y
CONFIG_CPU_CACHE_V7=y
CONFIG_CPU_CACHE_VIPT=y
CONFIG_CPU_TLB_V6=y
CONFIG_CPU_TLB_V7=y
This disables ARCH_NEEDS_KMAP_HIGH_GET in this kernel, which can be used on
ARMv6 VIPT non-aliasing, VIPT aliasing, as well as SMP stuff.
If we don't need ARCH_NEEDS_KMAP_HIGH_GET on V6 and V7, we should just not
enable it for those at all.
On Thu, 27 Jan 2011, Russell King - ARM Linux wrote:
On Thu, Jan 27, 2011 at 01:40:37PM -0500, Nicolas Pitre wrote:
quoted
On Thu, 27 Jan 2011, Russell King - ARM Linux wrote:
quoted
On Mon, Jan 24, 2011 at 02:58:07PM -0500, Nicolas Pitre wrote:
quoted
/*
+ * The reason for kmap_high_get() is to ensure that the currently kmap'd
+ * page usage count does not decrease to zero while we're using its
+ * existing virtual mapping in an atomic context. With a VIVT cache this
+ * is essential to do, but with a VIPT cache this is only an optimization
+ * so not to pay the price of establishing a second mapping if an existing
+ * one can be used. However, on platforms without hardware TLB maintainence
+ * broadcast, we simply cannot use ARCH_NEEDS_KMAP_HIGH_GET at all since
+ * the locking involved must also disable IRQs which is incompatible with
+ * the IPI mechanism used by global TLB operations.
+ */
+#define ARCH_NEEDS_KMAP_HIGH_GET
+#if defined(CONFIG_SMP) && defined(CONFIG_CPU_TLB_V6)
+#undef ARCH_NEEDS_KMAP_HIGH_GET
+#if defined(CONFIG_HIGHMEM) && defined(CONFIG_CPU_CACHE_VIVT)
+#error "The sum of feature in your kernel config cannot be supported together"
+#endif
This is wrong. Take a moment to consider a kernel supporting an ARMv6
VIPT aliasing cache CPU and ARMv7 SMP. Don't we need kmap_high_get()
for ARMv6 VIPT aliasing cache?
We don't support highmem on aliasing VIPT. Highmem gets disabled at run
time on aliasing VIPT platforms.
Correct. But a kernel which has this configuration:
CONFIG_SMP=y
CONFIG_HIGHMEM=y
CONFIG_CPU_V6=y
CONFIG_CPU_V7=y
CONFIG_CPU_32v6=y
CONFIG_CPU_32v7=y
CONFIG_CPU_CACHE_V6=y
CONFIG_CPU_CACHE_VIPT=y
CONFIG_CPU_CACHE_V7=y
CONFIG_CPU_CACHE_VIPT=y
CONFIG_CPU_TLB_V6=y
CONFIG_CPU_TLB_V7=y
This disables ARCH_NEEDS_KMAP_HIGH_GET in this kernel, which can be used on
ARMv6 VIPT non-aliasing, VIPT aliasing, as well as SMP stuff.
Yes.
On a VIPT aliasing target, highmem gets disabled at run time. So no
issue there.
Otherwise, on VIPT, it is not essential to have
ARCH_NEEDS_KMAP_HIGH_GET.
If we don't need ARCH_NEEDS_KMAP_HIGH_GET on V6 and V7, we should just not
enable it for those at all.
As I said in the patch comment, ARCH_NEEDS_KMAP_HIGH_GET is still a nice
optimization on VIPT. It avoids the creation of a second mapping and TLB
usage when an existing mapping from the pkmap array can be reused right
away. But if our kernel config indicates that we might run on a target
lacking hw TLB broadcast then we have to compromize and give up on that
optimization.
Nicolas