All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: torvalds@linux-foundation.org, akpm@linux-foundation.org,
	alan@lxorguk.ukuu.org.uk, Jonathan Nieder <jrnieder@gmail.com>,
	William Dauchy <wdauchy@gmail.com>,
	Dave Jiang <dave.jiang@intel.com>,
	Dan Williams <dan.j.williams@intel.com>
Subject: [ 55/59] ioat: fix size of completion for Xen
Date: Wed, 11 Apr 2012 16:11:30 -0700	[thread overview]
Message-ID: <20120411231044.837385150@linuxfoundation.org> (raw)
In-Reply-To: <20120411231213.GA13124@kroah.com>

3.2-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Dan Williams <dan.j.williams@intel.com>

commit 275029353953c2117941ade84f02a2303912fad1 upstream.

Starting with v3.2 Jonathan reports that Xen crashes loading the ioatdma
driver.  A debug run shows:

  ioatdma 0000:00:16.4: desc[0]: (0x300cc7000->0x300cc7040) cookie: 0 flags: 0x2 ctl: 0x29 (op: 0 int_en: 1 compl: 1)
  ...
  ioatdma 0000:00:16.4: ioat_get_current_completion: phys_complete: 0xcc7000

...which shows that in this environment GFP_KERNEL memory may be backed
by a 64-bit dma address.  This breaks the driver's assumption that an
unsigned long should be able to contain the physical address for
descriptor memory.  Switch to dma_addr_t which beyond being the right
size, is the true type for the data i.e. an io-virtual address
inidicating the engine's last processed descriptor.

Reported-by: Jonathan Nieder <jrnieder@gmail.com>
Reported-by: William Dauchy <wdauchy@gmail.com>
Tested-by: William Dauchy <wdauchy@gmail.com>
Tested-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 drivers/dma/ioat/dma.c    |   16 ++++++++--------
 drivers/dma/ioat/dma.h    |    6 +++---
 drivers/dma/ioat/dma_v2.c |    8 ++++----
 drivers/dma/ioat/dma_v3.c |    8 ++++----
 4 files changed, 19 insertions(+), 19 deletions(-)

--- a/drivers/dma/ioat/dma.c
+++ b/drivers/dma/ioat/dma.c
@@ -548,9 +548,9 @@ void ioat_dma_unmap(struct ioat_chan_com
 			   PCI_DMA_TODEVICE, flags, 0);
 }
 
-unsigned long ioat_get_current_completion(struct ioat_chan_common *chan)
+dma_addr_t ioat_get_current_completion(struct ioat_chan_common *chan)
 {
-	unsigned long phys_complete;
+	dma_addr_t phys_complete;
 	u64 completion;
 
 	completion = *chan->completion;
@@ -571,7 +571,7 @@ unsigned long ioat_get_current_completio
 }
 
 bool ioat_cleanup_preamble(struct ioat_chan_common *chan,
-			   unsigned long *phys_complete)
+			   dma_addr_t *phys_complete)
 {
 	*phys_complete = ioat_get_current_completion(chan);
 	if (*phys_complete == chan->last_completion)
@@ -582,14 +582,14 @@ bool ioat_cleanup_preamble(struct ioat_c
 	return true;
 }
 
-static void __cleanup(struct ioat_dma_chan *ioat, unsigned long phys_complete)
+static void __cleanup(struct ioat_dma_chan *ioat, dma_addr_t phys_complete)
 {
 	struct ioat_chan_common *chan = &ioat->base;
 	struct list_head *_desc, *n;
 	struct dma_async_tx_descriptor *tx;
 
-	dev_dbg(to_dev(chan), "%s: phys_complete: %lx\n",
-		 __func__, phys_complete);
+	dev_dbg(to_dev(chan), "%s: phys_complete: %llx\n",
+		 __func__, (unsigned long long) phys_complete);
 	list_for_each_safe(_desc, n, &ioat->used_desc) {
 		struct ioat_desc_sw *desc;
 
@@ -655,7 +655,7 @@ static void __cleanup(struct ioat_dma_ch
 static void ioat1_cleanup(struct ioat_dma_chan *ioat)
 {
 	struct ioat_chan_common *chan = &ioat->base;
-	unsigned long phys_complete;
+	dma_addr_t phys_complete;
 
 	prefetch(chan->completion);
 
@@ -701,7 +701,7 @@ static void ioat1_timer_event(unsigned l
 		mod_timer(&chan->timer, jiffies + COMPLETION_TIMEOUT);
 		spin_unlock_bh(&ioat->desc_lock);
 	} else if (test_bit(IOAT_COMPLETION_PENDING, &chan->state)) {
-		unsigned long phys_complete;
+		dma_addr_t phys_complete;
 
 		spin_lock_bh(&ioat->desc_lock);
 		/* if we haven't made progress and we have already
--- a/drivers/dma/ioat/dma.h
+++ b/drivers/dma/ioat/dma.h
@@ -88,7 +88,7 @@ struct ioatdma_device {
 struct ioat_chan_common {
 	struct dma_chan common;
 	void __iomem *reg_base;
-	unsigned long last_completion;
+	dma_addr_t last_completion;
 	spinlock_t cleanup_lock;
 	dma_cookie_t completed_cookie;
 	unsigned long state;
@@ -333,7 +333,7 @@ int __devinit ioat_dma_self_test(struct
 void __devexit ioat_dma_remove(struct ioatdma_device *device);
 struct dca_provider * __devinit ioat_dca_init(struct pci_dev *pdev,
 					      void __iomem *iobase);
-unsigned long ioat_get_current_completion(struct ioat_chan_common *chan);
+dma_addr_t ioat_get_current_completion(struct ioat_chan_common *chan);
 void ioat_init_channel(struct ioatdma_device *device,
 		       struct ioat_chan_common *chan, int idx);
 enum dma_status ioat_dma_tx_status(struct dma_chan *c, dma_cookie_t cookie,
@@ -341,7 +341,7 @@ enum dma_status ioat_dma_tx_status(struc
 void ioat_dma_unmap(struct ioat_chan_common *chan, enum dma_ctrl_flags flags,
 		    size_t len, struct ioat_dma_descriptor *hw);
 bool ioat_cleanup_preamble(struct ioat_chan_common *chan,
-			   unsigned long *phys_complete);
+			   dma_addr_t *phys_complete);
 void ioat_kobject_add(struct ioatdma_device *device, struct kobj_type *type);
 void ioat_kobject_del(struct ioatdma_device *device);
 extern const struct sysfs_ops ioat_sysfs_ops;
--- a/drivers/dma/ioat/dma_v2.c
+++ b/drivers/dma/ioat/dma_v2.c
@@ -126,7 +126,7 @@ static void ioat2_start_null_desc(struct
 	spin_unlock_bh(&ioat->prep_lock);
 }
 
-static void __cleanup(struct ioat2_dma_chan *ioat, unsigned long phys_complete)
+static void __cleanup(struct ioat2_dma_chan *ioat, dma_addr_t phys_complete)
 {
 	struct ioat_chan_common *chan = &ioat->base;
 	struct dma_async_tx_descriptor *tx;
@@ -178,7 +178,7 @@ static void __cleanup(struct ioat2_dma_c
 static void ioat2_cleanup(struct ioat2_dma_chan *ioat)
 {
 	struct ioat_chan_common *chan = &ioat->base;
-	unsigned long phys_complete;
+	dma_addr_t phys_complete;
 
 	spin_lock_bh(&chan->cleanup_lock);
 	if (ioat_cleanup_preamble(chan, &phys_complete))
@@ -259,7 +259,7 @@ int ioat2_reset_sync(struct ioat_chan_co
 static void ioat2_restart_channel(struct ioat2_dma_chan *ioat)
 {
 	struct ioat_chan_common *chan = &ioat->base;
-	unsigned long phys_complete;
+	dma_addr_t phys_complete;
 
 	ioat2_quiesce(chan, 0);
 	if (ioat_cleanup_preamble(chan, &phys_complete))
@@ -274,7 +274,7 @@ void ioat2_timer_event(unsigned long dat
 	struct ioat_chan_common *chan = &ioat->base;
 
 	if (test_bit(IOAT_COMPLETION_PENDING, &chan->state)) {
-		unsigned long phys_complete;
+		dma_addr_t phys_complete;
 		u64 status;
 
 		status = ioat_chansts(chan);
--- a/drivers/dma/ioat/dma_v3.c
+++ b/drivers/dma/ioat/dma_v3.c
@@ -256,7 +256,7 @@ static bool desc_has_ext(struct ioat_rin
  * The difference from the dma_v2.c __cleanup() is that this routine
  * handles extended descriptors and dma-unmapping raid operations.
  */
-static void __cleanup(struct ioat2_dma_chan *ioat, unsigned long phys_complete)
+static void __cleanup(struct ioat2_dma_chan *ioat, dma_addr_t phys_complete)
 {
 	struct ioat_chan_common *chan = &ioat->base;
 	struct ioat_ring_ent *desc;
@@ -314,7 +314,7 @@ static void __cleanup(struct ioat2_dma_c
 static void ioat3_cleanup(struct ioat2_dma_chan *ioat)
 {
 	struct ioat_chan_common *chan = &ioat->base;
-	unsigned long phys_complete;
+	dma_addr_t phys_complete;
 
 	spin_lock_bh(&chan->cleanup_lock);
 	if (ioat_cleanup_preamble(chan, &phys_complete))
@@ -333,7 +333,7 @@ static void ioat3_cleanup_event(unsigned
 static void ioat3_restart_channel(struct ioat2_dma_chan *ioat)
 {
 	struct ioat_chan_common *chan = &ioat->base;
-	unsigned long phys_complete;
+	dma_addr_t phys_complete;
 
 	ioat2_quiesce(chan, 0);
 	if (ioat_cleanup_preamble(chan, &phys_complete))
@@ -348,7 +348,7 @@ static void ioat3_timer_event(unsigned l
 	struct ioat_chan_common *chan = &ioat->base;
 
 	if (test_bit(IOAT_COMPLETION_PENDING, &chan->state)) {
-		unsigned long phys_complete;
+		dma_addr_t phys_complete;
 		u64 status;
 
 		status = ioat_chansts(chan);



  parent reply	other threads:[~2012-04-11 23:26 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-11 23:12 [ 00/59] 3.2.15-stable review Greg KH
2012-04-11 23:10 ` [ 01/59] x86 bpf_jit: fix a bug in emitting the 16-bit immediate operand of AND Greg KH
2012-04-11 23:10 ` [ 02/59] tg3: Fix 5717 serdes powerdown problem Greg KH
2012-04-11 23:10 ` [ 03/59] sky2: dont overwrite settings for PHY Quick link Greg KH
2012-04-11 23:10 ` [ 04/59] rose_dev: fix memcpy-bug in rose_set_mac_address Greg KH
2012-04-11 23:10 ` [ 05/59] net: usb: cdc_eem: fix mtu Greg KH
2012-04-11 23:10 ` [ 06/59] Fix non TBI PHY access; a bad merge undid bug fix in a previous commit Greg KH
2012-04-12  4:55   ` Ben Hutchings
     [not found]     ` <OFFBE17A27.42E05B7A-ONC12579DE.00262282-C12579DE.0026AD98@transmode.se>
2012-04-12 15:02       ` Ben Hutchings
2012-04-16  0:16     ` Paul Gortmaker
2012-04-16  0:16       ` Paul Gortmaker
2012-04-16  0:32       ` Ben Hutchings
2012-04-11 23:10 ` [ 07/59] ASoC: wm8994: Update WM8994 DCS calibration Greg KH
2012-04-11 23:10 ` [ 08/59] mtd: ixp4xx: oops in ixp4xx_flash_probe Greg KH
2012-04-11 23:10 ` [ 09/59] mtd: mips: lantiq: reintroduce support for cmdline partitions Greg KH
2012-04-11 23:10 ` [ 10/59] mtd: nand: gpmi: use correct member for checking NAND_BBT_USE_FLASH Greg KH
2012-04-11 23:10 ` [ 11/59] mtd: sst25l: initialize writebufsize Greg KH
2012-04-11 23:10 ` [ 12/59] mtd: block2mtd: " Greg KH
2012-04-11 23:10 ` [ 13/59] mtd: lart: " Greg KH
2012-04-11 23:10 ` [ 14/59] mtd: m25p80: set writebufsize Greg KH
2012-04-11 23:10 ` [ 15/59] ACPI: Do cpufreq clamping for throttling per package v2 Greg KH
2012-04-11 23:10 ` [ 16/59] PNPACPI: Fix device ref leaking in acpi_pnp_match Greg KH
2012-04-11 23:10 ` [ 17/59] ACPICA: Fix regression in FADT revision checks Greg KH
2012-04-11 23:10 ` [ 18/59] modpost: fix ALL_INIT_DATA_SECTIONS Greg KH
2012-04-11 23:10 ` [ 19/59] genirq: Adjust irq thread affinity on IRQ_SET_MASK_OK_NOCOPY return value Greg KH
2012-04-11 23:10 ` [ 20/59] tracing: Fix ftrace stack trace entries Greg KH
2012-04-11 23:10 ` [ 21/59] tracing: Fix ent_size in trace output Greg KH
2012-04-11 23:10 ` [ 22/59] m68k/mac: Add missing platform check before registering platform devices Greg KH
2012-04-11 23:10 ` [ 23/59] mac80211: fix possible tid_rx->reorder_timer use after free Greg KH
2012-04-11 23:10 ` [ 24/59] rtlwifi: rtl8192ce: rtl8192cu: rtl8192de: Fix low-gain setting when scanning Greg KH
2012-04-11 23:11 ` [ 25/59] drm: Validate requested virtual size against allocated fb size Greg KH
2012-04-11 23:11 ` [ 26/59] drm/radeon/kms: fix fans after resume Greg KH
2012-04-11 23:11 ` [ 27/59] drm/i915: no-lvds quirk on MSI DC500 Greg KH
2012-04-11 23:11 ` [ 28/59] drm/i915: Sanitize BIOS debugging bits from PIPECONF Greg KH
2012-04-11 23:11 ` [ 29/59] drm/i915: Add lock on drm_helper_resume_force_mode Greg KH
2012-04-11 23:11 ` [ 30/59] drm/i915: quirk away broken OpRegion VBT Greg KH
2012-04-11 23:11 ` [ 31/59] r8169: runtime resume before shutdown Greg KH
2012-04-11 23:11 ` [ 32/59] target: Fix unsupported WRITE_SAME sense payload Greg KH
2012-04-11 23:11 ` [ 33/59] kgdb,debug_core: pass the breakpoint struct instead of address and memory Greg KH
2012-04-11 23:11 ` [ 34/59] kgdbts: Fix kernel oops with CONFIG_DEBUG_RODATA Greg KH
2012-04-11 23:11 ` [ 35/59] kgdbts: (1 of 2) fix single step awareness to work correctly with SMP Greg KH
2012-04-11 23:11 ` [ 36/59] kgdbts: (2 " Greg KH
2012-04-11 23:11 ` [ 37/59] x86,kgdb: Fix DEBUG_RODATA limitation using text_poke() Greg KH
2012-04-11 23:11 ` [ 38/59] CIFS: Fix VFS lock usage for oplocked files Greg KH
2012-04-11 23:11 ` [ 39/59] [PATCH] ARM: tegra: remove Tegra30 errata from MACH_TEGRA_DT Greg KH
2012-04-11 23:11 ` [ 40/59] mmc: sdhci-dove: Fix compile error by including module.h Greg KH
2012-04-11 23:11 ` [ 41/59] mmc: atmel-mci: correct data timeout computation Greg KH
2012-04-11 23:11 ` [ 42/59] tcm_fc: Add abort flag for gracefully handling exchange timeout Greg KH
2012-04-11 23:11 ` [ 43/59] tcm_fc: Do not free tpg structure during wq allocation failure Greg KH
2012-04-11 23:11 ` [ 44/59] sysctl: fix write access to dmesg_restrict/kptr_restrict Greg KH
2012-04-11 23:11 ` [ 45/59] modpost: Fix modpost license checking of vmlinux.o Greg KH
2012-04-11 23:11 ` [ 46/59] x86/PCI: use host bridge _CRS info on MSI MS-7253 Greg KH
2012-04-11 23:11 ` [ 47/59] x86/PCI: do not tie MSI MS-7253 use_crs quirk to BIOS version Greg KH
2012-04-11 23:11 ` [ 48/59] TOMOYO: Fix mount flags checking order Greg KH
2012-04-11 23:11 ` [ 49/59] Revert "x86/ioapic: Add register level checks to detect bogus io-apic entries" Greg KH
2012-04-11 23:11 ` [ 50/59] acer-wmi: No wifi rfkill on Sony machines Greg KH
2012-04-11 23:11 ` [ 51/59] Fix length of buffer copied in __nfs4_get_acl_uncached Greg KH
2012-04-11 23:11 ` [ 52/59] sched/x86: Fix overflow in cyc2ns_offset Greg KH
2012-04-11 23:11 ` [ 53/59] mfd: Clear twl6030 IRQ status register only once Greg KH
2012-04-11 23:11 ` [ 54/59] USB: Add Motorola Rokr E6 Id to the USBNet driver "zaurus" Greg KH
2012-04-11 23:11 ` Greg KH [this message]
2012-04-11 23:11 ` [ 56/59] ASoC: ak4642: fixup: mute needs +1 step Greg KH
2012-04-11 23:11 ` [ 57/59] cred: copy_process() should clear child->replacement_session_keyring Greg KH
2012-04-11 23:11 ` [ 58/59] iommu/amd: Make sure IOMMU interrupts are re-enabled on resume Greg KH
2012-04-11 23:11 ` [ 59/59] Bluetooth: Fix l2cap conn failures for ssp devices Greg KH

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=20120411231044.837385150@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=jrnieder@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=wdauchy@gmail.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 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.