Linux v3.14-rc3-20-g60f76ea
- Reenable debugging options.
This commit is contained in:
parent
8c6a41b939
commit
92e57c7432
@ -1661,13 +1661,13 @@ CONFIG_B43_SDIO=y
|
||||
CONFIG_B43_BCMA=y
|
||||
# CONFIG_B43_BCMA_EXTRA is not set
|
||||
CONFIG_B43_BCMA_PIO=y
|
||||
# CONFIG_B43_DEBUG is not set
|
||||
CONFIG_B43_DEBUG=y
|
||||
CONFIG_B43_PHY_LP=y
|
||||
CONFIG_B43_PHY_N=y
|
||||
CONFIG_B43_PHY_HT=y
|
||||
# CONFIG_B43_FORCE_PIO is not set
|
||||
CONFIG_B43LEGACY=m
|
||||
# CONFIG_B43LEGACY_DEBUG is not set
|
||||
CONFIG_B43LEGACY_DEBUG=y
|
||||
CONFIG_B43LEGACY_DMA=y
|
||||
CONFIG_B43LEGACY_PIO=y
|
||||
CONFIG_B43LEGACY_DMA_AND_PIO_MODE=y
|
||||
@ -3502,7 +3502,7 @@ CONFIG_USB_STORAGE_REALTEK=m
|
||||
CONFIG_REALTEK_AUTOPM=y
|
||||
CONFIG_USB_STORAGE_ENE_UB6250=m
|
||||
# CONFIG_USB_LIBUSUAL is not set
|
||||
# CONFIG_USB_UAS is not set
|
||||
CONFIG_USB_UAS=m
|
||||
|
||||
|
||||
#
|
||||
@ -4570,7 +4570,7 @@ CONFIG_PM_DEBUG=y
|
||||
# CONFIG_DPM_WATCHDOG is not set # revisit this in debug
|
||||
CONFIG_PM_TRACE=y
|
||||
CONFIG_PM_TRACE_RTC=y
|
||||
# CONFIG_PM_TEST_SUSPEND is not set
|
||||
CONFIG_PM_TEST_SUSPEND=y
|
||||
CONFIG_PM_RUNTIME=y
|
||||
# CONFIG_PM_OPP is not set
|
||||
# CONFIG_PM_AUTOSLEEP is not set
|
||||
|
112
config-nodebug
112
config-nodebug
@ -2,98 +2,98 @@ CONFIG_SND_VERBOSE_PRINTK=y
|
||||
CONFIG_SND_DEBUG=y
|
||||
CONFIG_SND_PCM_XRUN_DEBUG=y
|
||||
|
||||
# CONFIG_DEBUG_ATOMIC_SLEEP is not set
|
||||
CONFIG_DEBUG_ATOMIC_SLEEP=y
|
||||
|
||||
# CONFIG_DEBUG_MUTEXES is not set
|
||||
# CONFIG_DEBUG_WW_MUTEX_SLOWPATH is not set
|
||||
# CONFIG_DEBUG_RT_MUTEXES is not set
|
||||
# CONFIG_DEBUG_LOCK_ALLOC is not set
|
||||
# CONFIG_PROVE_LOCKING is not set
|
||||
# CONFIG_DEBUG_SPINLOCK is not set
|
||||
# CONFIG_PROVE_RCU is not set
|
||||
CONFIG_DEBUG_MUTEXES=y
|
||||
CONFIG_DEBUG_WW_MUTEX_SLOWPATH=y
|
||||
CONFIG_DEBUG_RT_MUTEXES=y
|
||||
CONFIG_DEBUG_LOCK_ALLOC=y
|
||||
CONFIG_PROVE_LOCKING=y
|
||||
CONFIG_DEBUG_SPINLOCK=y
|
||||
CONFIG_PROVE_RCU=y
|
||||
# CONFIG_PROVE_RCU_REPEATEDLY is not set
|
||||
# CONFIG_DEBUG_PER_CPU_MAPS is not set
|
||||
CONFIG_DEBUG_PER_CPU_MAPS=y
|
||||
CONFIG_CPUMASK_OFFSTACK=y
|
||||
|
||||
# CONFIG_CPU_NOTIFIER_ERROR_INJECT is not set
|
||||
CONFIG_CPU_NOTIFIER_ERROR_INJECT=m
|
||||
|
||||
# CONFIG_FAULT_INJECTION is not set
|
||||
# CONFIG_FAILSLAB is not set
|
||||
# CONFIG_FAIL_PAGE_ALLOC is not set
|
||||
# CONFIG_FAIL_MAKE_REQUEST is not set
|
||||
# CONFIG_FAULT_INJECTION_DEBUG_FS is not set
|
||||
# CONFIG_FAULT_INJECTION_STACKTRACE_FILTER is not set
|
||||
# CONFIG_FAIL_IO_TIMEOUT is not set
|
||||
# CONFIG_FAIL_MMC_REQUEST is not set
|
||||
CONFIG_FAULT_INJECTION=y
|
||||
CONFIG_FAILSLAB=y
|
||||
CONFIG_FAIL_PAGE_ALLOC=y
|
||||
CONFIG_FAIL_MAKE_REQUEST=y
|
||||
CONFIG_FAULT_INJECTION_DEBUG_FS=y
|
||||
CONFIG_FAULT_INJECTION_STACKTRACE_FILTER=y
|
||||
CONFIG_FAIL_IO_TIMEOUT=y
|
||||
CONFIG_FAIL_MMC_REQUEST=y
|
||||
|
||||
# CONFIG_LOCK_STAT is not set
|
||||
CONFIG_LOCK_STAT=y
|
||||
|
||||
# CONFIG_DEBUG_STACK_USAGE is not set
|
||||
CONFIG_DEBUG_STACK_USAGE=y
|
||||
|
||||
# CONFIG_ACPI_DEBUG is not set
|
||||
CONFIG_ACPI_DEBUG=y
|
||||
# CONFIG_ACPI_DEBUG_FUNC_TRACE is not set
|
||||
|
||||
# CONFIG_DEBUG_SG is not set
|
||||
CONFIG_DEBUG_SG=y
|
||||
|
||||
# CONFIG_DEBUG_PAGEALLOC is not set
|
||||
|
||||
# CONFIG_DEBUG_WRITECOUNT is not set
|
||||
# CONFIG_DEBUG_OBJECTS is not set
|
||||
CONFIG_DEBUG_WRITECOUNT=y
|
||||
CONFIG_DEBUG_OBJECTS=y
|
||||
# CONFIG_DEBUG_OBJECTS_SELFTEST is not set
|
||||
# CONFIG_DEBUG_OBJECTS_FREE is not set
|
||||
# CONFIG_DEBUG_OBJECTS_TIMERS is not set
|
||||
# CONFIG_DEBUG_OBJECTS_RCU_HEAD is not set
|
||||
CONFIG_DEBUG_OBJECTS_FREE=y
|
||||
CONFIG_DEBUG_OBJECTS_TIMERS=y
|
||||
CONFIG_DEBUG_OBJECTS_RCU_HEAD=y
|
||||
CONFIG_DEBUG_OBJECTS_ENABLE_DEFAULT=1
|
||||
|
||||
# CONFIG_X86_PTDUMP is not set
|
||||
CONFIG_X86_PTDUMP=y
|
||||
|
||||
# CONFIG_CAN_DEBUG_DEVICES is not set
|
||||
CONFIG_CAN_DEBUG_DEVICES=y
|
||||
|
||||
# CONFIG_MODULE_FORCE_UNLOAD is not set
|
||||
CONFIG_MODULE_FORCE_UNLOAD=y
|
||||
|
||||
# CONFIG_SYSCTL_SYSCALL_CHECK is not set
|
||||
CONFIG_SYSCTL_SYSCALL_CHECK=y
|
||||
|
||||
# CONFIG_DEBUG_NOTIFIERS is not set
|
||||
CONFIG_DEBUG_NOTIFIERS=y
|
||||
|
||||
# CONFIG_DMA_API_DEBUG is not set
|
||||
CONFIG_DMA_API_DEBUG=y
|
||||
|
||||
# CONFIG_MMIOTRACE is not set
|
||||
CONFIG_MMIOTRACE=y
|
||||
|
||||
# CONFIG_DEBUG_CREDENTIALS is not set
|
||||
CONFIG_DEBUG_CREDENTIALS=y
|
||||
|
||||
# off in both production debug and nodebug builds,
|
||||
# on in rawhide nodebug builds
|
||||
# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
|
||||
CONFIG_DEBUG_FORCE_WEAK_PER_CPU=y
|
||||
|
||||
# CONFIG_EXT4_DEBUG is not set
|
||||
CONFIG_EXT4_DEBUG=y
|
||||
|
||||
# CONFIG_XFS_WARN is not set
|
||||
|
||||
# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
|
||||
CONFIG_DEBUG_PERF_USE_VMALLOC=y
|
||||
|
||||
# CONFIG_JBD2_DEBUG is not set
|
||||
CONFIG_JBD2_DEBUG=y
|
||||
|
||||
# CONFIG_NFSD_FAULT_INJECTION is not set
|
||||
CONFIG_NFSD_FAULT_INJECTION=y
|
||||
|
||||
# CONFIG_DEBUG_BLK_CGROUP is not set
|
||||
CONFIG_DEBUG_BLK_CGROUP=y
|
||||
|
||||
# CONFIG_DRBD_FAULT_INJECTION is not set
|
||||
CONFIG_DRBD_FAULT_INJECTION=y
|
||||
|
||||
# CONFIG_ATH_DEBUG is not set
|
||||
# CONFIG_CARL9170_DEBUGFS is not set
|
||||
# CONFIG_IWLWIFI_DEVICE_TRACING is not set
|
||||
CONFIG_ATH_DEBUG=y
|
||||
CONFIG_CARL9170_DEBUGFS=y
|
||||
CONFIG_IWLWIFI_DEVICE_TRACING=y
|
||||
|
||||
# CONFIG_RTLWIFI_DEBUG is not set
|
||||
|
||||
# CONFIG_DEBUG_OBJECTS_WORK is not set
|
||||
CONFIG_DEBUG_OBJECTS_WORK=y
|
||||
|
||||
# CONFIG_DMADEVICES_DEBUG is not set
|
||||
# CONFIG_DMADEVICES_VDEBUG is not set
|
||||
CONFIG_DMADEVICES_DEBUG=y
|
||||
CONFIG_DMADEVICES_VDEBUG=y
|
||||
|
||||
CONFIG_PM_ADVANCED_DEBUG=y
|
||||
|
||||
# CONFIG_CEPH_LIB_PRETTYDEBUG is not set
|
||||
# CONFIG_QUOTA_DEBUG is not set
|
||||
CONFIG_CEPH_LIB_PRETTYDEBUG=y
|
||||
CONFIG_QUOTA_DEBUG=y
|
||||
|
||||
CONFIG_PCI_DEFAULT_USE_CRS=y
|
||||
|
||||
@ -101,18 +101,18 @@ CONFIG_KGDB_KDB=y
|
||||
CONFIG_KDB_KEYBOARD=y
|
||||
CONFIG_KDB_CONTINUE_CATASTROPHIC=0
|
||||
|
||||
# CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER is not set
|
||||
CONFIG_DEBUG_OBJECTS_PERCPU_COUNTER=y
|
||||
# CONFIG_PERCPU_TEST is not set
|
||||
# CONFIG_TEST_LIST_SORT is not set
|
||||
CONFIG_TEST_LIST_SORT=y
|
||||
# CONFIG_TEST_STRING_HELPERS is not set
|
||||
|
||||
# CONFIG_DETECT_HUNG_TASK is not set
|
||||
CONFIG_DETECT_HUNG_TASK=y
|
||||
CONFIG_DEFAULT_HUNG_TASK_TIMEOUT=120
|
||||
# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
|
||||
|
||||
# CONFIG_X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK is not set
|
||||
CONFIG_X86_BOOTPARAM_MEMORY_CORRUPTION_CHECK=y
|
||||
|
||||
# CONFIG_DEBUG_KMEMLEAK is not set
|
||||
CONFIG_DEBUG_KMEMLEAK=y
|
||||
CONFIG_DEBUG_KMEMLEAK_EARLY_LOG_SIZE=1024
|
||||
# CONFIG_DEBUG_KMEMLEAK_TEST is not set
|
||||
CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=y
|
||||
@ -123,7 +123,7 @@ CONFIG_DEBUG_KMEMLEAK_DEFAULT_OFF=y
|
||||
|
||||
# CONFIG_SPI_DEBUG is not set
|
||||
|
||||
# CONFIG_X86_DEBUG_STATIC_CPU_HAS is not set
|
||||
CONFIG_X86_DEBUG_STATIC_CPU_HAS=y
|
||||
|
||||
# CONFIG_SCHEDSTATS is not set
|
||||
# CONFIG_LATENCYTOP is not set
|
||||
|
@ -334,7 +334,7 @@ CONFIG_SP5100_TCO=m
|
||||
|
||||
# CONFIG_MEMTEST is not set
|
||||
# CONFIG_DEBUG_TLBFLUSH is not set
|
||||
# CONFIG_MAXSMP is not set
|
||||
CONFIG_MAXSMP=y
|
||||
|
||||
|
||||
CONFIG_HP_ILO=m
|
||||
|
298
dma-debug-account-for-cachelines-and-read-only-mappings.patch
Normal file
298
dma-debug-account-for-cachelines-and-read-only-mappings.patch
Normal file
@ -0,0 +1,298 @@
|
||||
Bugzilla: 1062833
|
||||
Upstream-status: Submitted for 3.14
|
||||
|
||||
While debug_dma_assert_idle() checks if a given *page* is actively
|
||||
undergoing dma the valid granularity of a dma mapping is a *cacheline*.
|
||||
Sander's testing shows that the warning message "DMA-API: exceeded 7
|
||||
overlapping mappings of pfn..." is falsely triggering. The test is
|
||||
simply mapping multiple cachelines in a given page.
|
||||
|
||||
Ultimately we want overlap tracking to be valid as it is a real api
|
||||
violation, so we need to track active mappings by cachelines. Update
|
||||
the active dma tracking to use the page-frame-relative cacheline of the
|
||||
mapping as the key, and update debug_dma_assert_idle() to check for all
|
||||
possible mapped cachelines for a given page.
|
||||
|
||||
However, the need to track active mappings is only relevant when the
|
||||
dma-mapping is writable by the device. In fact it is fairly standard
|
||||
for read-only mappings to have hundreds or thousands of overlapping
|
||||
mappings at once. Limiting the overlap tracking to writable
|
||||
(!DMA_TO_DEVICE) eliminates this class of false-positive overlap
|
||||
reports.
|
||||
|
||||
Note, the radix gang lookup is sub-optimal. It would be best if it
|
||||
stopped fetching entries once the search passed a page boundary.
|
||||
Nevertheless, this implementation does not perturb the original net_dma
|
||||
failing case. That is to say the extra overhead does not show up in
|
||||
terms of making the failing case pass due to a timing change.
|
||||
|
||||
References:
|
||||
http://marc.info/?l=linux-netdev&m=139232263419315&w=2
|
||||
http://marc.info/?l=linux-netdev&m=139217088107122&w=2
|
||||
|
||||
Reported-by: Sander Eikelenboom <linux@eikelenboom.it>
|
||||
Reported-by: Dave Jones <davej@redhat.com>
|
||||
Tested-by: Dave Jones <davej@redhat.com>
|
||||
Tested-by: Sander Eikelenboom <linux@eikelenboom.it>
|
||||
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Cc: Francois Romieu <romieu@fr.zoreil.com>
|
||||
Cc: Eric Dumazet <eric.dumazet@gmail.com>
|
||||
Cc: Wei Liu <wei.liu2@citrix.com>
|
||||
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
|
||||
---
|
||||
|
||||
Changes in v2:
|
||||
1/ replaced 'cln' acronym with 'cacheline'. Now 'cln' is only a local
|
||||
variable name
|
||||
|
||||
2/ renamed 'to_cln()' to 'to_cacheline_number()'
|
||||
|
||||
3/ made the storage for a 'cacheline number' phys_addr_t since...
|
||||
"unsigned long cln = page_to_pfn(page) << CACHELINE_PER_PAGE_SHIFT;"
|
||||
...may drop bits on some archs/memory-models.
|
||||
|
||||
lib/dma-debug.c | 131 ++++++++++++++++++++++++++++++++++++-------------------
|
||||
1 files changed, 85 insertions(+), 46 deletions(-)
|
||||
|
||||
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
|
||||
index 2defd1308b04..98f2d7e91a91 100644
|
||||
--- a/lib/dma-debug.c
|
||||
+++ b/lib/dma-debug.c
|
||||
@@ -424,111 +424,134 @@ void debug_dma_dump_mappings(struct device *dev)
|
||||
EXPORT_SYMBOL(debug_dma_dump_mappings);
|
||||
|
||||
/*
|
||||
- * For each page mapped (initial page in the case of
|
||||
- * dma_alloc_coherent/dma_map_{single|page}, or each page in a
|
||||
- * scatterlist) insert into this tree using the pfn as the key. At
|
||||
+ * For each mapping (initial cacheline in the case of
|
||||
+ * dma_alloc_coherent/dma_map_page, initial cacheline in each page of a
|
||||
+ * scatterlist, or the cacheline specified in dma_map_single) insert
|
||||
+ * into this tree using the cacheline as the key. At
|
||||
* dma_unmap_{single|sg|page} or dma_free_coherent delete the entry. If
|
||||
- * the pfn already exists at insertion time add a tag as a reference
|
||||
+ * the entry already exists at insertion time add a tag as a reference
|
||||
* count for the overlapping mappings. For now, the overlap tracking
|
||||
- * just ensures that 'unmaps' balance 'maps' before marking the pfn
|
||||
- * idle, but we should also be flagging overlaps as an API violation.
|
||||
+ * just ensures that 'unmaps' balance 'maps' before marking the
|
||||
+ * cacheline idle, but we should also be flagging overlaps as an API
|
||||
+ * violation.
|
||||
*
|
||||
* Memory usage is mostly constrained by the maximum number of available
|
||||
* dma-debug entries in that we need a free dma_debug_entry before
|
||||
- * inserting into the tree. In the case of dma_map_{single|page} and
|
||||
- * dma_alloc_coherent there is only one dma_debug_entry and one pfn to
|
||||
- * track per event. dma_map_sg(), on the other hand,
|
||||
- * consumes a single dma_debug_entry, but inserts 'nents' entries into
|
||||
- * the tree.
|
||||
+ * inserting into the tree. In the case of dma_map_page and
|
||||
+ * dma_alloc_coherent there is only one dma_debug_entry and one
|
||||
+ * dma_active_cacheline entry to track per event. dma_map_sg(), on the
|
||||
+ * other hand, consumes a single dma_debug_entry, but inserts 'nents'
|
||||
+ * entries into the tree.
|
||||
*
|
||||
* At any time debug_dma_assert_idle() can be called to trigger a
|
||||
- * warning if the given page is in the active set.
|
||||
+ * warning if any cachelines in the given page are in the active set.
|
||||
*/
|
||||
-static RADIX_TREE(dma_active_pfn, GFP_NOWAIT);
|
||||
+static RADIX_TREE(dma_active_cacheline, GFP_NOWAIT);
|
||||
static DEFINE_SPINLOCK(radix_lock);
|
||||
-#define ACTIVE_PFN_MAX_OVERLAP ((1 << RADIX_TREE_MAX_TAGS) - 1)
|
||||
+#define ACTIVE_CACHELINE_MAX_OVERLAP ((1 << RADIX_TREE_MAX_TAGS) - 1)
|
||||
+#define CACHELINE_PER_PAGE_SHIFT (PAGE_SHIFT - L1_CACHE_SHIFT)
|
||||
+#define CACHELINES_PER_PAGE (1 << CACHELINE_PER_PAGE_SHIFT)
|
||||
|
||||
-static int active_pfn_read_overlap(unsigned long pfn)
|
||||
+static phys_addr_t to_cacheline_number(struct dma_debug_entry *entry)
|
||||
+{
|
||||
+ return (entry->pfn << CACHELINE_PER_PAGE_SHIFT) +
|
||||
+ (entry->offset >> L1_CACHE_SHIFT);
|
||||
+}
|
||||
+
|
||||
+static int active_cacheline_read_overlap(phys_addr_t cln)
|
||||
{
|
||||
int overlap = 0, i;
|
||||
|
||||
for (i = RADIX_TREE_MAX_TAGS - 1; i >= 0; i--)
|
||||
- if (radix_tree_tag_get(&dma_active_pfn, pfn, i))
|
||||
+ if (radix_tree_tag_get(&dma_active_cacheline, cln, i))
|
||||
overlap |= 1 << i;
|
||||
return overlap;
|
||||
}
|
||||
|
||||
-static int active_pfn_set_overlap(unsigned long pfn, int overlap)
|
||||
+static int active_cacheline_set_overlap(phys_addr_t cln, int overlap)
|
||||
{
|
||||
int i;
|
||||
|
||||
- if (overlap > ACTIVE_PFN_MAX_OVERLAP || overlap < 0)
|
||||
+ if (overlap > ACTIVE_CACHELINE_MAX_OVERLAP || overlap < 0)
|
||||
return overlap;
|
||||
|
||||
for (i = RADIX_TREE_MAX_TAGS - 1; i >= 0; i--)
|
||||
if (overlap & 1 << i)
|
||||
- radix_tree_tag_set(&dma_active_pfn, pfn, i);
|
||||
+ radix_tree_tag_set(&dma_active_cacheline, cln, i);
|
||||
else
|
||||
- radix_tree_tag_clear(&dma_active_pfn, pfn, i);
|
||||
+ radix_tree_tag_clear(&dma_active_cacheline, cln, i);
|
||||
|
||||
return overlap;
|
||||
}
|
||||
|
||||
-static void active_pfn_inc_overlap(unsigned long pfn)
|
||||
+static void active_cacheline_inc_overlap(phys_addr_t cln)
|
||||
{
|
||||
- int overlap = active_pfn_read_overlap(pfn);
|
||||
+ int overlap = active_cacheline_read_overlap(cln);
|
||||
|
||||
- overlap = active_pfn_set_overlap(pfn, ++overlap);
|
||||
+ overlap = active_cacheline_set_overlap(cln, ++overlap);
|
||||
|
||||
/* If we overflowed the overlap counter then we're potentially
|
||||
* leaking dma-mappings. Otherwise, if maps and unmaps are
|
||||
* balanced then this overflow may cause false negatives in
|
||||
- * debug_dma_assert_idle() as the pfn may be marked idle
|
||||
+ * debug_dma_assert_idle() as the cacheline may be marked idle
|
||||
* prematurely.
|
||||
*/
|
||||
- WARN_ONCE(overlap > ACTIVE_PFN_MAX_OVERLAP,
|
||||
- "DMA-API: exceeded %d overlapping mappings of pfn %lx\n",
|
||||
- ACTIVE_PFN_MAX_OVERLAP, pfn);
|
||||
+ WARN_ONCE(overlap > ACTIVE_CACHELINE_MAX_OVERLAP,
|
||||
+ "DMA-API: exceeded %d overlapping mappings of cacheline %pa\n",
|
||||
+ ACTIVE_CACHELINE_MAX_OVERLAP, &cln);
|
||||
}
|
||||
|
||||
-static int active_pfn_dec_overlap(unsigned long pfn)
|
||||
+static int active_cacheline_dec_overlap(phys_addr_t cln)
|
||||
{
|
||||
- int overlap = active_pfn_read_overlap(pfn);
|
||||
+ int overlap = active_cacheline_read_overlap(cln);
|
||||
|
||||
- return active_pfn_set_overlap(pfn, --overlap);
|
||||
+ return active_cacheline_set_overlap(cln, --overlap);
|
||||
}
|
||||
|
||||
-static int active_pfn_insert(struct dma_debug_entry *entry)
|
||||
+static int active_cacheline_insert(struct dma_debug_entry *entry)
|
||||
{
|
||||
+ phys_addr_t cln = to_cacheline_number(entry);
|
||||
unsigned long flags;
|
||||
int rc;
|
||||
|
||||
+ /* If the device is not writing memory then we don't have any
|
||||
+ * concerns about the cpu consuming stale data. This mitigates
|
||||
+ * legitimate usages of overlapping mappings.
|
||||
+ */
|
||||
+ if (entry->direction == DMA_TO_DEVICE)
|
||||
+ return 0;
|
||||
+
|
||||
spin_lock_irqsave(&radix_lock, flags);
|
||||
- rc = radix_tree_insert(&dma_active_pfn, entry->pfn, entry);
|
||||
+ rc = radix_tree_insert(&dma_active_cacheline, cln, entry);
|
||||
if (rc == -EEXIST)
|
||||
- active_pfn_inc_overlap(entry->pfn);
|
||||
+ active_cacheline_inc_overlap(cln);
|
||||
spin_unlock_irqrestore(&radix_lock, flags);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
-static void active_pfn_remove(struct dma_debug_entry *entry)
|
||||
+static void active_cacheline_remove(struct dma_debug_entry *entry)
|
||||
{
|
||||
+ phys_addr_t cln = to_cacheline_number(entry);
|
||||
unsigned long flags;
|
||||
|
||||
+ /* ...mirror the insert case */
|
||||
+ if (entry->direction == DMA_TO_DEVICE)
|
||||
+ return;
|
||||
+
|
||||
spin_lock_irqsave(&radix_lock, flags);
|
||||
/* since we are counting overlaps the final put of the
|
||||
- * entry->pfn will occur when the overlap count is 0.
|
||||
- * active_pfn_dec_overlap() returns -1 in that case
|
||||
+ * cacheline will occur when the overlap count is 0.
|
||||
+ * active_cacheline_dec_overlap() returns -1 in that case
|
||||
*/
|
||||
- if (active_pfn_dec_overlap(entry->pfn) < 0)
|
||||
- radix_tree_delete(&dma_active_pfn, entry->pfn);
|
||||
+ if (active_cacheline_dec_overlap(cln) < 0)
|
||||
+ radix_tree_delete(&dma_active_cacheline, cln);
|
||||
spin_unlock_irqrestore(&radix_lock, flags);
|
||||
}
|
||||
|
||||
/**
|
||||
* debug_dma_assert_idle() - assert that a page is not undergoing dma
|
||||
- * @page: page to lookup in the dma_active_pfn tree
|
||||
+ * @page: page to lookup in the dma_active_cacheline tree
|
||||
*
|
||||
* Place a call to this routine in cases where the cpu touching the page
|
||||
* before the dma completes (page is dma_unmapped) will lead to data
|
||||
@@ -536,22 +559,38 @@ static void active_pfn_remove(struct dma_debug_entry *entry)
|
||||
*/
|
||||
void debug_dma_assert_idle(struct page *page)
|
||||
{
|
||||
+ static struct dma_debug_entry *ents[CACHELINES_PER_PAGE];
|
||||
+ struct dma_debug_entry *entry = NULL;
|
||||
+ void **results = (void **) &ents;
|
||||
+ unsigned int nents, i;
|
||||
unsigned long flags;
|
||||
- struct dma_debug_entry *entry;
|
||||
+ phys_addr_t cln;
|
||||
|
||||
if (!page)
|
||||
return;
|
||||
|
||||
+ cln = (phys_addr_t) page_to_pfn(page) << CACHELINE_PER_PAGE_SHIFT;
|
||||
spin_lock_irqsave(&radix_lock, flags);
|
||||
- entry = radix_tree_lookup(&dma_active_pfn, page_to_pfn(page));
|
||||
+ nents = radix_tree_gang_lookup(&dma_active_cacheline, results, cln,
|
||||
+ CACHELINES_PER_PAGE);
|
||||
+ for (i = 0; i < nents; i++) {
|
||||
+ phys_addr_t ent_cln = to_cacheline_number(ents[i]);
|
||||
+
|
||||
+ if (ent_cln == cln) {
|
||||
+ entry = ents[i];
|
||||
+ break;
|
||||
+ } else if (ent_cln >= cln + CACHELINES_PER_PAGE)
|
||||
+ break;
|
||||
+ }
|
||||
spin_unlock_irqrestore(&radix_lock, flags);
|
||||
|
||||
if (!entry)
|
||||
return;
|
||||
|
||||
+ cln = to_cacheline_number(entry);
|
||||
err_printk(entry->dev, entry,
|
||||
- "DMA-API: cpu touching an active dma mapped page "
|
||||
- "[pfn=0x%lx]\n", entry->pfn);
|
||||
+ "DMA-API: cpu touching an active dma mapped cacheline [cln=%pa]\n",
|
||||
+ &cln);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -568,9 +607,9 @@ static void add_dma_entry(struct dma_debug_entry *entry)
|
||||
hash_bucket_add(bucket, entry);
|
||||
put_hash_bucket(bucket, &flags);
|
||||
|
||||
- rc = active_pfn_insert(entry);
|
||||
+ rc = active_cacheline_insert(entry);
|
||||
if (rc == -ENOMEM) {
|
||||
- pr_err("DMA-API: pfn tracking ENOMEM, dma-debug disabled\n");
|
||||
+ pr_err("DMA-API: cacheline tracking ENOMEM, dma-debug disabled\n");
|
||||
global_disable = true;
|
||||
}
|
||||
|
||||
@@ -631,7 +670,7 @@ static void dma_entry_free(struct dma_debug_entry *entry)
|
||||
{
|
||||
unsigned long flags;
|
||||
|
||||
- active_pfn_remove(entry);
|
||||
+ active_cacheline_remove(entry);
|
||||
|
||||
/*
|
||||
* add to beginning of the list - this way the entries are
|
14
kernel.spec
14
kernel.spec
@ -61,7 +61,7 @@ Summary: The Linux kernel
|
||||
# The rc snapshot level
|
||||
%define rcrev 3
|
||||
# The git snapshot level
|
||||
%define gitrev 0
|
||||
%define gitrev 1
|
||||
# Set rpm version accordingly
|
||||
%define rpmversion 3.%{upstream_sublevel}.0
|
||||
%endif
|
||||
@ -122,7 +122,7 @@ Summary: The Linux kernel
|
||||
# Set debugbuildsenabled to 1 for production (build separate debug kernels)
|
||||
# and 0 for rawhide (all kernels are debug kernels).
|
||||
# See also 'make debug' and 'make release'.
|
||||
%define debugbuildsenabled 1
|
||||
%define debugbuildsenabled 0
|
||||
|
||||
# Want to build a vanilla kernel build without any non-upstream patches?
|
||||
%define with_vanilla %{?_with_vanilla: 1} %{?!_with_vanilla: 0}
|
||||
@ -625,6 +625,9 @@ Patch25195: cgroup-fixes.patch
|
||||
Patch25200: cifs-ensure-that-uncached-writes-handle-unmapped-areas-correctly.patch
|
||||
Patch25201: cifs-sanity-check-length-of-data-to-send-before-sending.patch
|
||||
|
||||
#rhbz 1062833
|
||||
Patch25202: dma-debug-account-for-cachelines-and-read-only-mappings.patch
|
||||
|
||||
# END OF PATCH DEFINITIONS
|
||||
|
||||
%endif
|
||||
@ -1272,6 +1275,9 @@ ApplyPatch cgroup-fixes.patch
|
||||
ApplyPatch cifs-ensure-that-uncached-writes-handle-unmapped-areas-correctly.patch
|
||||
ApplyPatch cifs-sanity-check-length-of-data-to-send-before-sending.patch
|
||||
|
||||
#rhbz 1062833
|
||||
ApplyPatch dma-debug-account-for-cachelines-and-read-only-mappings.patch
|
||||
|
||||
|
||||
# END OF PATCH APPLICATIONS
|
||||
|
||||
@ -2052,6 +2058,10 @@ fi
|
||||
# ||----w |
|
||||
# || ||
|
||||
%changelog
|
||||
* Tue Feb 18 2014 Josh Boyer <jwboyer@fedoraproject.org> - 3.14.0-0.rc3.git1.1
|
||||
- Linux v3.14-rc3-20-g60f76ea
|
||||
- Reenable debugging options.
|
||||
|
||||
* Mon Feb 17 2014 Josh Boyer <jwboyer@fedoraproject.org> - 3.14.0-0.rc3.git0.1
|
||||
- Linux v3.14-rc3
|
||||
- Disable debugging options.
|
||||
|
Loading…
Reference in New Issue
Block a user