--- /dev/null
+From eb7c3adb1ca92450870dbb0d347fc986cd5e2af4 Mon Sep 17 00:00:00 2001
+From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
+Date: Fri, 14 Nov 2008 06:45:23 +0000
+Subject: e1000e: fix IPMI traffic
+
+From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
+
+commit eb7c3adb1ca92450870dbb0d347fc986cd5e2af4 upstream.
+
+Some users reported that they have machines with BMCs enabled that cannot
+receive IPMI traffic after e1000e is loaded.
+http://marc.info/?l=e1000-devel&m=121909039127414&w=2
+http://marc.info/?l=e1000-devel&m=121365543823387&w=2
+
+This fixes the issue if they load with the new parameter = 0 by disabling
+crc stripping, but leaves the performance feature on for most users.
+Based on work done by Hong Zhang.
+
+Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
+Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Cc: Bryon Roche <kain@kain.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/net/e1000e/e1000.h | 5 +++++
+ drivers/net/e1000e/netdev.c | 23 +++++++++++++++++++++--
+ drivers/net/e1000e/param.c | 25 +++++++++++++++++++++++++
+ 3 files changed, 51 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/e1000e/e1000.h
++++ b/drivers/net/e1000e/e1000.h
+@@ -283,6 +283,7 @@ struct e1000_adapter {
+ unsigned long led_status;
+
+ unsigned int flags;
++ unsigned int flags2;
+ struct work_struct downshift_task;
+ struct work_struct update_phy_task;
+ };
+@@ -290,6 +291,7 @@ struct e1000_adapter {
+ struct e1000_info {
+ enum e1000_mac_type mac;
+ unsigned int flags;
++ unsigned int flags2;
+ u32 pba;
+ s32 (*get_variants)(struct e1000_adapter *);
+ struct e1000_mac_operations *mac_ops;
+@@ -330,6 +332,9 @@ struct e1000_info {
+ #define FLAG_RX_RESTART_NOW (1 << 30)
+ #define FLAG_MSI_TEST_FAILED (1 << 31)
+
++/* CRC Stripping defines */
++#define FLAG2_CRC_STRIPPING (1 << 0)
++
+ #define E1000_RX_DESC_PS(R, i) \
+ (&(((union e1000_rx_desc_packet_split *)((R).desc))[i]))
+ #define E1000_GET_DESC(R, i, type) (&(((struct type *)((R).desc))[i]))
+--- a/drivers/net/e1000e/netdev.c
++++ b/drivers/net/e1000e/netdev.c
+@@ -497,6 +497,10 @@ static bool e1000_clean_rx_irq(struct e1
+ goto next_desc;
+ }
+
++ /* adjust length to remove Ethernet CRC */
++ if (!(adapter->flags2 & FLAG2_CRC_STRIPPING))
++ length -= 4;
++
+ total_rx_bytes += length;
+ total_rx_packets++;
+
+@@ -802,6 +806,10 @@ static bool e1000_clean_rx_irq_ps(struct
+ pci_dma_sync_single_for_device(pdev, ps_page->dma,
+ PAGE_SIZE, PCI_DMA_FROMDEVICE);
+
++ /* remove the CRC */
++ if (!(adapter->flags2 & FLAG2_CRC_STRIPPING))
++ l1 -= 4;
++
+ skb_put(skb, l1);
+ goto copydone;
+ } /* if */
+@@ -823,6 +831,12 @@ static bool e1000_clean_rx_irq_ps(struct
+ skb->truesize += length;
+ }
+
++ /* strip the ethernet crc, problem is we're using pages now so
++ * this whole operation can get a little cpu intensive
++ */
++ if (!(adapter->flags2 & FLAG2_CRC_STRIPPING))
++ pskb_trim(skb, skb->len - 4);
++
+ copydone:
+ total_rx_bytes += skb->len;
+ total_rx_packets++;
+@@ -1987,8 +2001,12 @@ static void e1000_setup_rctl(struct e100
+ else
+ rctl |= E1000_RCTL_LPE;
+
+- /* Enable hardware CRC frame stripping */
+- rctl |= E1000_RCTL_SECRC;
++ /* Some systems expect that the CRC is included in SMBUS traffic. The
++ * hardware strips the CRC before sending to both SMBUS (BMC) and to
++ * host memory when this is enabled
++ */
++ if (adapter->flags2 & FLAG2_CRC_STRIPPING)
++ rctl |= E1000_RCTL_SECRC;
+
+ /* Setup buffer sizes */
+ rctl &= ~E1000_RCTL_SZ_4096;
+@@ -4412,6 +4430,7 @@ static int __devinit e1000_probe(struct
+ adapter->ei = ei;
+ adapter->pba = ei->pba;
+ adapter->flags = ei->flags;
++ adapter->flags2 = ei->flags2;
+ adapter->hw.adapter = adapter;
+ adapter->hw.mac.type = ei->mac;
+ adapter->msg_enable = (1 << NETIF_MSG_DRV | NETIF_MSG_PROBE) - 1;
+--- a/drivers/net/e1000e/param.c
++++ b/drivers/net/e1000e/param.c
+@@ -142,6 +142,16 @@ E1000_PARAM(KumeranLockLoss, "Enable Kum
+ */
+ E1000_PARAM(WriteProtectNVM, "Write-protect NVM [WARNING: disabling this can lead to corrupted NVM]");
+
++/*
++ * Enable CRC Stripping
++ *
++ * Valid Range: 0, 1
++ *
++ * Default Value: 1 (enabled)
++ */
++E1000_PARAM(CrcStripping, "Enable CRC Stripping, disable if your BMC needs " \
++ "the CRC");
++
+ struct e1000_option {
+ enum { enable_option, range_option, list_option } type;
+ const char *name;
+@@ -377,6 +387,21 @@ void __devinit e1000e_check_options(stru
+ adapter->flags |= FLAG_SMART_POWER_DOWN;
+ }
+ }
++ { /* CRC Stripping */
++ const struct e1000_option opt = {
++ .type = enable_option,
++ .name = "CRC Stripping",
++ .err = "defaulting to enabled",
++ .def = OPTION_ENABLED
++ };
++
++ if (num_CrcStripping > bd) {
++ unsigned int crc_stripping = CrcStripping[bd];
++ e1000_validate_option(&crc_stripping, &opt, adapter);
++ if (crc_stripping == OPTION_ENABLED)
++ adapter->flags2 |= FLAG2_CRC_STRIPPING;
++ }
++ }
+ { /* Kumeran Lock Loss Workaround */
+ const struct e1000_option opt = {
+ .type = enable_option,
--- /dev/null
+From a17d5232de7b53d34229de79ec22f4bb04adb7e4 Mon Sep 17 00:00:00 2001
+From: Duane Griffin <duaneg@dghda.com>
+Date: Fri, 19 Dec 2008 20:47:10 +0000
+Subject: eCryptfs: check readlink result was not an error before using it
+
+From: Duane Griffin <duaneg@dghda.com>
+
+commit a17d5232de7b53d34229de79ec22f4bb04adb7e4 upstream.
+
+The result from readlink is being used to index into the link name
+buffer without checking whether it is a valid length. If readlink
+returns an error this will fault or cause memory corruption.
+
+Cc: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
+Cc: Dustin Kirkland <kirkland@canonical.com>
+Cc: ecryptfs-devel@lists.launchpad.net
+Signed-off-by: Duane Griffin <duaneg@dghda.com>
+Acked-by: Michael Halcrow <mhalcrow@us.ibm.com>
+Acked-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>
+Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ fs/ecryptfs/inode.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/fs/ecryptfs/inode.c
++++ b/fs/ecryptfs/inode.c
+@@ -673,10 +673,11 @@ static void *ecryptfs_follow_link(struct
+ ecryptfs_printk(KERN_DEBUG, "Calling readlink w/ "
+ "dentry->d_name.name = [%s]\n", dentry->d_name.name);
+ rc = dentry->d_inode->i_op->readlink(dentry, (char __user *)buf, len);
+- buf[rc] = '\0';
+ set_fs(old_fs);
+ if (rc < 0)
+ goto out_free;
++ else
++ buf[rc] = '\0';
+ rc = 0;
+ nd_set_link(nd, buf);
+ goto out;
--- /dev/null
+From dc711ca35f9d95a1eec02118e0c298b5e3068315 Mon Sep 17 00:00:00 2001
+From: Al Viro <viro@zeniv.linux.org.uk>
+Date: Mon, 3 Nov 2008 15:03:50 -0500
+Subject: fix switch_names() breakage in short-to-short case
+
+From: Al Viro <viro@zeniv.linux.org.uk>
+
+commit dc711ca35f9d95a1eec02118e0c298b5e3068315 upstream.
+
+We want ->name.len to match the resulting name on *both*
+source and target
+
+Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ fs/dcache.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/fs/dcache.c
++++ b/fs/dcache.c
+@@ -1615,8 +1615,11 @@ static void switch_names(struct dentry *
+ */
+ memcpy(dentry->d_iname, target->d_name.name,
+ target->d_name.len + 1);
++ dentry->d_name.len = target->d_name.len;
++ return;
+ }
+ }
++ do_switch(dentry->d_name.len, target->d_name.len);
+ }
+
+ /*
+@@ -1676,7 +1679,6 @@ already_unhashed:
+
+ /* Switch the names.. */
+ switch_names(dentry, target);
+- do_switch(dentry->d_name.len, target->d_name.len);
+ do_switch(dentry->d_name.hash, target->d_name.hash);
+
+ /* ... and switch the parents */
+@@ -1781,7 +1783,6 @@ static void __d_materialise_dentry(struc
+ struct dentry *dparent, *aparent;
+
+ switch_names(dentry, anon);
+- do_switch(dentry->d_name.len, anon->d_name.len);
+ do_switch(dentry->d_name.hash, anon->d_name.hash);
+
+ dparent = dentry->d_parent;
--- /dev/null
+From 54566b2c1594c2326a645a3551f9d989f7ba3c5e Mon Sep 17 00:00:00 2001
+From: Nick Piggin <npiggin@suse.de>
+Date: Sun, 4 Jan 2009 12:00:53 -0800
+Subject: fs: symlink write_begin allocation context fix
+
+From: Nick Piggin <npiggin@suse.de>
+
+commit 54566b2c1594c2326a645a3551f9d989f7ba3c5e upstream.
+
+With the write_begin/write_end aops, page_symlink was broken because it
+could no longer pass a GFP_NOFS type mask into the point where the
+allocations happened. They are done in write_begin, which would always
+assume that the filesystem can be entered from reclaim. This bug could
+cause filesystem deadlocks.
+
+The funny thing with having a gfp_t mask there is that it doesn't really
+allow the caller to arbitrarily tinker with the context in which it can be
+called. It couldn't ever be GFP_ATOMIC, for example, because it needs to
+take the page lock. The only thing any callers care about is __GFP_FS
+anyway, so turn that into a single flag.
+
+Add a new flag for write_begin, AOP_FLAG_NOFS. Filesystems can now act on
+this flag in their write_begin function. Change __grab_cache_page to
+accept a nofs argument as well, to honour that flag (while we're there,
+change the name to grab_cache_page_write_begin which is more instructive
+and does away with random leading underscores).
+
+This is really a more flexible way to go in the end anyway -- if a
+filesystem happens to want any extra allocations aside from the pagecache
+ones in ints write_begin function, it may now use GFP_KERNEL (rather than
+GFP_NOFS) for common case allocations (eg. ocfs2_alloc_write_ctxt, for a
+random example).
+
+[kosaki.motohiro@jp.fujitsu.com: fix ubifs]
+[kosaki.motohiro@jp.fujitsu.com: fix fuse]
+Signed-off-by: Nick Piggin <npiggin@suse.de>
+Reviewed-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
+Cc: <stable@kernel.org> [2.6.28.x]
+Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+[ Cleaned up the calling convention: just pass in the AOP flags
+ untouched to the grab_cache_page_write_begin() function. That
+ just simplifies everybody, and may even allow future expansion of the
+ logic. - Linus ]
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ fs/affs/file.c | 2 +-
+ fs/buffer.c | 4 ++--
+ fs/ext3/inode.c | 2 +-
+ fs/ext3/namei.c | 3 +--
+ fs/ext4/inode.c | 4 ++--
+ fs/ext4/namei.c | 3 +--
+ fs/fuse/file.c | 4 ++--
+ fs/gfs2/ops_address.c | 2 +-
+ fs/hostfs/hostfs_kern.c | 2 +-
+ fs/jffs2/file.c | 2 +-
+ fs/libfs.c | 2 +-
+ fs/namei.c | 13 +++++++++----
+ fs/nfs/file.c | 2 +-
+ fs/reiserfs/inode.c | 2 +-
+ fs/smbfs/file.c | 2 +-
+ fs/ubifs/file.c | 9 +++++----
+ include/linux/fs.h | 5 ++++-
+ include/linux/pagemap.h | 3 ++-
+ mm/filemap.c | 17 +++++++++++------
+ 19 files changed, 48 insertions(+), 35 deletions(-)
+
+--- a/fs/affs/file.c
++++ b/fs/affs/file.c
+@@ -628,7 +628,7 @@ static int affs_write_begin_ofs(struct f
+ }
+
+ index = pos >> PAGE_CACHE_SHIFT;
+- page = __grab_cache_page(mapping, index);
++ page = grab_cache_page_write_begin(mapping, index, flags);
+ if (!page)
+ return -ENOMEM;
+ *pagep = page;
+--- a/fs/buffer.c
++++ b/fs/buffer.c
+@@ -1988,7 +1988,7 @@ int block_write_begin(struct file *file,
+ page = *pagep;
+ if (page == NULL) {
+ ownpage = 1;
+- page = __grab_cache_page(mapping, index);
++ page = grab_cache_page_write_begin(mapping, index, flags);
+ if (!page) {
+ status = -ENOMEM;
+ goto out;
+@@ -2494,7 +2494,7 @@ int nobh_write_begin(struct file *file,
+ from = pos & (PAGE_CACHE_SIZE - 1);
+ to = from + len;
+
+- page = __grab_cache_page(mapping, index);
++ page = grab_cache_page_write_begin(mapping, index, flags);
+ if (!page)
+ return -ENOMEM;
+ *pagep = page;
+--- a/fs/ext3/inode.c
++++ b/fs/ext3/inode.c
+@@ -1152,7 +1152,7 @@ static int ext3_write_begin(struct file
+ to = from + len;
+
+ retry:
+- page = __grab_cache_page(mapping, index);
++ page = grab_cache_page_write_begin(mapping, index, flags);
+ if (!page)
+ return -ENOMEM;
+ *pagep = page;
+--- a/fs/ext3/namei.c
++++ b/fs/ext3/namei.c
+@@ -2187,8 +2187,7 @@ retry:
+ * We have a transaction open. All is sweetness. It also sets
+ * i_size in generic_commit_write().
+ */
+- err = __page_symlink(inode, symname, l,
+- mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS);
++ err = __page_symlink(inode, symname, l, 1);
+ if (err) {
+ drop_nlink(inode);
+ ext3_mark_inode_dirty(handle, inode);
+--- a/fs/ext4/inode.c
++++ b/fs/ext4/inode.c
+@@ -1370,7 +1370,7 @@ retry:
+ goto out;
+ }
+
+- page = __grab_cache_page(mapping, index);
++ page = grab_cache_page_write_begin(mapping, index, flags);
+ if (!page) {
+ ext4_journal_stop(handle);
+ ret = -ENOMEM;
+@@ -2421,7 +2421,7 @@ retry:
+ goto out;
+ }
+
+- page = __grab_cache_page(mapping, index);
++ page = grab_cache_page_write_begin(mapping, index, flags);
+ if (!page) {
+ ext4_journal_stop(handle);
+ ret = -ENOMEM;
+--- a/fs/ext4/namei.c
++++ b/fs/ext4/namei.c
+@@ -2216,8 +2216,7 @@ retry:
+ * We have a transaction open. All is sweetness. It also sets
+ * i_size in generic_commit_write().
+ */
+- err = __page_symlink(inode, symname, l,
+- mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS);
++ err = __page_symlink(inode, symname, l, 1);
+ if (err) {
+ clear_nlink(inode);
+ ext4_mark_inode_dirty(handle, inode);
+--- a/fs/fuse/file.c
++++ b/fs/fuse/file.c
+@@ -644,7 +644,7 @@ static int fuse_write_begin(struct file
+ {
+ pgoff_t index = pos >> PAGE_CACHE_SHIFT;
+
+- *pagep = __grab_cache_page(mapping, index);
++ *pagep = grab_cache_page_write_begin(mapping, index, flags);
+ if (!*pagep)
+ return -ENOMEM;
+ return 0;
+@@ -777,7 +777,7 @@ static ssize_t fuse_fill_write_pages(str
+ break;
+
+ err = -ENOMEM;
+- page = __grab_cache_page(mapping, index);
++ page = grab_cache_page_write_begin(mapping, index, 0);
+ if (!page)
+ break;
+
+--- a/fs/gfs2/ops_address.c
++++ b/fs/gfs2/ops_address.c
+@@ -675,7 +675,7 @@ static int gfs2_write_begin(struct file
+ goto out_trans_fail;
+
+ error = -ENOMEM;
+- page = __grab_cache_page(mapping, index);
++ page = grab_cache_page_write_begin(mapping, index, flags);
+ *pagep = page;
+ if (unlikely(!page))
+ goto out_endtrans;
+--- a/fs/hostfs/hostfs_kern.c
++++ b/fs/hostfs/hostfs_kern.c
+@@ -500,7 +500,7 @@ int hostfs_write_begin(struct file *file
+ {
+ pgoff_t index = pos >> PAGE_CACHE_SHIFT;
+
+- *pagep = __grab_cache_page(mapping, index);
++ *pagep = grab_cache_page_write_begin(mapping, index, flags);
+ if (!*pagep)
+ return -ENOMEM;
+ return 0;
+--- a/fs/jffs2/file.c
++++ b/fs/jffs2/file.c
+@@ -132,7 +132,7 @@ static int jffs2_write_begin(struct file
+ uint32_t pageofs = index << PAGE_CACHE_SHIFT;
+ int ret = 0;
+
+- pg = __grab_cache_page(mapping, index);
++ pg = grab_cache_page_write_begin(mapping, index, flags);
+ if (!pg)
+ return -ENOMEM;
+ *pagep = pg;
+--- a/fs/libfs.c
++++ b/fs/libfs.c
+@@ -360,7 +360,7 @@ int simple_write_begin(struct file *file
+ index = pos >> PAGE_CACHE_SHIFT;
+ from = pos & (PAGE_CACHE_SIZE - 1);
+
+- page = __grab_cache_page(mapping, index);
++ page = grab_cache_page_write_begin(mapping, index, flags);
+ if (!page)
+ return -ENOMEM;
+
+--- a/fs/namei.c
++++ b/fs/namei.c
+@@ -2796,18 +2796,23 @@ void page_put_link(struct dentry *dentry
+ }
+ }
+
+-int __page_symlink(struct inode *inode, const char *symname, int len,
+- gfp_t gfp_mask)
++/*
++ * The nofs argument instructs pagecache_write_begin to pass AOP_FLAG_NOFS
++ */
++int __page_symlink(struct inode *inode, const char *symname, int len, int nofs)
+ {
+ struct address_space *mapping = inode->i_mapping;
+ struct page *page;
+ void *fsdata;
+ int err;
+ char *kaddr;
++ unsigned int flags = AOP_FLAG_UNINTERRUPTIBLE;
++ if (nofs)
++ flags |= AOP_FLAG_NOFS;
+
+ retry:
+ err = pagecache_write_begin(NULL, mapping, 0, len-1,
+- AOP_FLAG_UNINTERRUPTIBLE, &page, &fsdata);
++ flags, &page, &fsdata);
+ if (err)
+ goto fail;
+
+@@ -2831,7 +2836,7 @@ fail:
+ int page_symlink(struct inode *inode, const char *symname, int len)
+ {
+ return __page_symlink(inode, symname, len,
+- mapping_gfp_mask(inode->i_mapping));
++ !(mapping_gfp_mask(inode->i_mapping) & __GFP_FS));
+ }
+
+ const struct inode_operations page_symlink_inode_operations = {
+--- a/fs/nfs/file.c
++++ b/fs/nfs/file.c
+@@ -351,7 +351,7 @@ static int nfs_write_begin(struct file *
+ file->f_path.dentry->d_name.name,
+ mapping->host->i_ino, len, (long long) pos);
+
+- page = __grab_cache_page(mapping, index);
++ page = grab_cache_page_write_begin(mapping, index, flags);
+ if (!page)
+ return -ENOMEM;
+ *pagep = page;
+--- a/fs/reiserfs/inode.c
++++ b/fs/reiserfs/inode.c
+@@ -2565,7 +2565,7 @@ static int reiserfs_write_begin(struct f
+ }
+
+ index = pos >> PAGE_CACHE_SHIFT;
+- page = __grab_cache_page(mapping, index);
++ page = grab_cache_page_write_begin(mapping, index, flags);
+ if (!page)
+ return -ENOMEM;
+ *pagep = page;
+--- a/fs/smbfs/file.c
++++ b/fs/smbfs/file.c
+@@ -297,7 +297,7 @@ static int smb_write_begin(struct file *
+ struct page **pagep, void **fsdata)
+ {
+ pgoff_t index = pos >> PAGE_CACHE_SHIFT;
+- *pagep = __grab_cache_page(mapping, index);
++ *pagep = grab_cache_page_write_begin(mapping, index, flags);
+ if (!*pagep)
+ return -ENOMEM;
+ return 0;
+--- a/fs/ubifs/file.c
++++ b/fs/ubifs/file.c
+@@ -213,7 +213,8 @@ static void release_existing_page_budget
+ }
+
+ static int write_begin_slow(struct address_space *mapping,
+- loff_t pos, unsigned len, struct page **pagep)
++ loff_t pos, unsigned len, struct page **pagep,
++ unsigned flags)
+ {
+ struct inode *inode = mapping->host;
+ struct ubifs_info *c = inode->i_sb->s_fs_info;
+@@ -241,7 +242,7 @@ static int write_begin_slow(struct addre
+ if (unlikely(err))
+ return err;
+
+- page = __grab_cache_page(mapping, index);
++ page = grab_cache_page_write_begin(mapping, index, flags);
+ if (unlikely(!page)) {
+ ubifs_release_budget(c, &req);
+ return -ENOMEM;
+@@ -432,7 +433,7 @@ static int ubifs_write_begin(struct file
+ return -EROFS;
+
+ /* Try out the fast-path part first */
+- page = __grab_cache_page(mapping, index);
++ page = grab_cache_page_write_begin(mapping, index, flags);
+ if (unlikely(!page))
+ return -ENOMEM;
+
+@@ -477,7 +478,7 @@ static int ubifs_write_begin(struct file
+ unlock_page(page);
+ page_cache_release(page);
+
+- return write_begin_slow(mapping, pos, len, pagep);
++ return write_begin_slow(mapping, pos, len, pagep, flags);
+ }
+
+ /*
+--- a/include/linux/fs.h
++++ b/include/linux/fs.h
+@@ -403,6 +403,9 @@ enum positive_aop_returns {
+
+ #define AOP_FLAG_UNINTERRUPTIBLE 0x0001 /* will not do a short write */
+ #define AOP_FLAG_CONT_EXPAND 0x0002 /* called from cont_expand */
++#define AOP_FLAG_NOFS 0x0004 /* used by filesystem to direct
++ * helper code (eg buffer layer)
++ * to clear GFP_FS from alloc */
+
+ /*
+ * oh the beauties of C type declarations.
+@@ -1959,7 +1962,7 @@ extern int page_readlink(struct dentry *
+ extern void *page_follow_link_light(struct dentry *, struct nameidata *);
+ extern void page_put_link(struct dentry *, struct nameidata *, void *);
+ extern int __page_symlink(struct inode *inode, const char *symname, int len,
+- gfp_t gfp_mask);
++ int nofs);
+ extern int page_symlink(struct inode *inode, const char *symname, int len);
+ extern const struct inode_operations page_symlink_inode_operations;
+ extern int generic_readlink(struct dentry *, char __user *, int);
+--- a/include/linux/pagemap.h
++++ b/include/linux/pagemap.h
+@@ -213,7 +213,8 @@ unsigned find_get_pages_contig(struct ad
+ unsigned find_get_pages_tag(struct address_space *mapping, pgoff_t *index,
+ int tag, unsigned int nr_pages, struct page **pages);
+
+-struct page *__grab_cache_page(struct address_space *mapping, pgoff_t index);
++struct page *grab_cache_page_write_begin(struct address_space *mapping,
++ pgoff_t index, unsigned flags);
+
+ /*
+ * Returns locked page at given index in given cache, creating it if needed.
+--- a/mm/filemap.c
++++ b/mm/filemap.c
+@@ -2033,7 +2033,7 @@ int pagecache_write_begin(struct file *f
+ struct inode *inode = mapping->host;
+ struct page *page;
+ again:
+- page = __grab_cache_page(mapping, index);
++ page = grab_cache_page_write_begin(mapping, index, flags);
+ *pagep = page;
+ if (!page)
+ return -ENOMEM;
+@@ -2197,19 +2197,24 @@ EXPORT_SYMBOL(generic_file_direct_write)
+ * Find or create a page at the given pagecache position. Return the locked
+ * page. This function is specifically for buffered writes.
+ */
+-struct page *__grab_cache_page(struct address_space *mapping, pgoff_t index)
++struct page *grab_cache_page_write_begin(struct address_space *mapping,
++ pgoff_t index, unsigned flags)
+ {
+ int status;
+ struct page *page;
++ gfp_t gfp_notmask = 0;
++ if (flags & AOP_FLAG_NOFS)
++ gfp_notmask = __GFP_FS;
+ repeat:
+ page = find_lock_page(mapping, index);
+ if (likely(page))
+ return page;
+
+- page = page_cache_alloc(mapping);
++ page = __page_cache_alloc(mapping_gfp_mask(mapping) & ~gfp_notmask);
+ if (!page)
+ return NULL;
+- status = add_to_page_cache_lru(page, mapping, index, GFP_KERNEL);
++ status = add_to_page_cache_lru(page, mapping, index,
++ GFP_KERNEL & ~gfp_notmask);
+ if (unlikely(status)) {
+ page_cache_release(page);
+ if (status == -EEXIST)
+@@ -2218,7 +2223,7 @@ repeat:
+ }
+ return page;
+ }
+-EXPORT_SYMBOL(__grab_cache_page);
++EXPORT_SYMBOL(grab_cache_page_write_begin);
+
+ static ssize_t generic_perform_write_2copy(struct file *file,
+ struct iov_iter *i, loff_t pos)
+@@ -2263,7 +2268,7 @@ static ssize_t generic_perform_write_2co
+ break;
+ }
+
+- page = __grab_cache_page(mapping, index);
++ page = grab_cache_page_write_begin(mapping, index, GFP_KERNEL);
+ if (!page) {
+ status = -ENOMEM;
+ break;
--- /dev/null
+From 1c41fa8288277e76785acb50f52bb2f39509f903 Mon Sep 17 00:00:00 2001
+From: Brian King <brking@linux.vnet.ibm.com>
+Date: Wed, 3 Dec 2008 11:02:54 -0600
+Subject: [SCSI] ibmvfc: Delay NPIV login retry and add retries
+
+From: Brian King <brking@linux.vnet.ibm.com>
+
+commit 1c41fa8288277e76785acb50f52bb2f39509f903 upstream.
+
+Adds a delay prior to retrying a failed NPIV login. This fixes
+a scenario if the backing fibre channel adapter is getting reset
+due to an EEH event, NPIV login will fail. Currently, ibmvfc
+retries three times very quickly, resets the CRQ and tries one
+more time. If the adapter is getting reset due to EEH, this isn't
+enough time. This adds a delay prior to retrying a failed NPIV
+login and also increments the number of retries.
+
+Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
+Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/scsi/ibmvscsi/ibmvfc.c | 17 ++++++++++++-----
+ drivers/scsi/ibmvscsi/ibmvfc.h | 4 +++-
+ 2 files changed, 15 insertions(+), 6 deletions(-)
+
+--- a/drivers/scsi/ibmvscsi/ibmvfc.c
++++ b/drivers/scsi/ibmvscsi/ibmvfc.c
+@@ -566,7 +566,7 @@ static void ibmvfc_init_host(struct ibmv
+ struct ibmvfc_target *tgt;
+
+ if (vhost->action == IBMVFC_HOST_ACTION_INIT_WAIT) {
+- if (++vhost->init_retries > IBMVFC_MAX_INIT_RETRIES) {
++ if (++vhost->init_retries > IBMVFC_MAX_HOST_INIT_RETRIES) {
+ dev_err(vhost->dev,
+ "Host initialization retries exceeded. Taking adapter offline\n");
+ ibmvfc_link_down(vhost, IBMVFC_HOST_OFFLINE);
+@@ -847,11 +847,12 @@ static void ibmvfc_reset_host(struct ibm
+ static void ibmvfc_retry_host_init(struct ibmvfc_host *vhost)
+ {
+ if (vhost->action == IBMVFC_HOST_ACTION_INIT_WAIT) {
+- if (++vhost->init_retries > IBMVFC_MAX_INIT_RETRIES) {
++ vhost->delay_init = 1;
++ if (++vhost->init_retries > IBMVFC_MAX_HOST_INIT_RETRIES) {
+ dev_err(vhost->dev,
+ "Host initialization retries exceeded. Taking adapter offline\n");
+ ibmvfc_link_down(vhost, IBMVFC_HOST_OFFLINE);
+- } else if (vhost->init_retries == IBMVFC_MAX_INIT_RETRIES)
++ } else if (vhost->init_retries == IBMVFC_MAX_HOST_INIT_RETRIES)
+ __ibmvfc_reset_host(vhost);
+ else
+ ibmvfc_set_host_action(vhost, IBMVFC_HOST_ACTION_INIT);
+@@ -2671,7 +2672,7 @@ static void ibmvfc_init_tgt(struct ibmvf
+ static void ibmvfc_retry_tgt_init(struct ibmvfc_target *tgt,
+ void (*job_step) (struct ibmvfc_target *))
+ {
+- if (++tgt->init_retries > IBMVFC_MAX_INIT_RETRIES) {
++ if (++tgt->init_retries > IBMVFC_MAX_TGT_INIT_RETRIES) {
+ ibmvfc_set_tgt_action(tgt, IBMVFC_TGT_ACTION_DEL_RPORT);
+ wake_up(&tgt->vhost->work_wait_q);
+ } else
+@@ -3521,7 +3522,13 @@ static void ibmvfc_do_work(struct ibmvfc
+ break;
+ case IBMVFC_HOST_ACTION_INIT:
+ BUG_ON(vhost->state != IBMVFC_INITIALIZING);
+- vhost->job_step(vhost);
++ if (vhost->delay_init) {
++ vhost->delay_init = 0;
++ spin_unlock_irqrestore(vhost->host->host_lock, flags);
++ ssleep(5);
++ return;
++ } else
++ vhost->job_step(vhost);
+ break;
+ case IBMVFC_HOST_ACTION_QUERY:
+ list_for_each_entry(tgt, &vhost->targets, queue)
+--- a/drivers/scsi/ibmvscsi/ibmvfc.h
++++ b/drivers/scsi/ibmvscsi/ibmvfc.h
+@@ -43,7 +43,8 @@
+ #define IBMVFC_MAX_DISC_THREADS 4
+ #define IBMVFC_TGT_MEMPOOL_SZ 64
+ #define IBMVFC_MAX_CMDS_PER_LUN 64
+-#define IBMVFC_MAX_INIT_RETRIES 3
++#define IBMVFC_MAX_HOST_INIT_RETRIES 6
++#define IBMVFC_MAX_TGT_INIT_RETRIES 3
+ #define IBMVFC_DEV_LOSS_TMO (5 * 60)
+ #define IBMVFC_DEFAULT_LOG_LEVEL 2
+ #define IBMVFC_MAX_CDB_LEN 16
+@@ -671,6 +672,7 @@ struct ibmvfc_host {
+ int discovery_threads;
+ int client_migrated;
+ int reinit;
++ int delay_init;
+ int events_to_log;
+ #define IBMVFC_AE_LINKUP 0x0001
+ #define IBMVFC_AE_LINKDOWN 0x0002
--- /dev/null
+From d2131b33c7e07c2905ee2f2321cc4dae1928c483 Mon Sep 17 00:00:00 2001
+From: Brian King <brking@linux.vnet.ibm.com>
+Date: Thu, 18 Dec 2008 09:26:51 -0600
+Subject: [SCSI] ibmvfc: Improve async event handling
+
+From: Brian King <brking@linux.vnet.ibm.com>
+
+commit d2131b33c7e07c2905ee2f2321cc4dae1928c483 upstream.
+
+While doing various error injection testing, such as cable
+pulls and target moves, some issues were observed in handling
+these events. This patch improves the way these events are handled
+by increasing the delay waiting for the fabric to settle and also
+changes the behavior of Link Up to break the CRQ to ensure everything
+gets cleaned up properly on the VIOS.
+
+Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
+Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/scsi/ibmvscsi/ibmvfc.c | 10 ++++++----
+ drivers/scsi/ibmvscsi/ibmvfc.h | 2 +-
+ 2 files changed, 7 insertions(+), 5 deletions(-)
+
+--- a/drivers/scsi/ibmvscsi/ibmvfc.c
++++ b/drivers/scsi/ibmvscsi/ibmvfc.c
+@@ -2092,15 +2092,17 @@ static void ibmvfc_handle_async(struct i
+ case IBMVFC_AE_LINK_UP:
+ case IBMVFC_AE_RESUME:
+ vhost->events_to_log |= IBMVFC_AE_LINKUP;
+- ibmvfc_init_host(vhost, 1);
++ vhost->delay_init = 1;
++ __ibmvfc_reset_host(vhost);
+ break;
+ case IBMVFC_AE_SCN_FABRIC:
++ case IBMVFC_AE_SCN_DOMAIN:
+ vhost->events_to_log |= IBMVFC_AE_RSCN;
+- ibmvfc_init_host(vhost, 1);
++ vhost->delay_init = 1;
++ __ibmvfc_reset_host(vhost);
+ break;
+ case IBMVFC_AE_SCN_NPORT:
+ case IBMVFC_AE_SCN_GROUP:
+- case IBMVFC_AE_SCN_DOMAIN:
+ vhost->events_to_log |= IBMVFC_AE_RSCN;
+ case IBMVFC_AE_ELS_LOGO:
+ case IBMVFC_AE_ELS_PRLO:
+@@ -3525,7 +3527,7 @@ static void ibmvfc_do_work(struct ibmvfc
+ if (vhost->delay_init) {
+ vhost->delay_init = 0;
+ spin_unlock_irqrestore(vhost->host->host_lock, flags);
+- ssleep(5);
++ ssleep(15);
+ return;
+ } else
+ vhost->job_step(vhost);
+--- a/drivers/scsi/ibmvscsi/ibmvfc.h
++++ b/drivers/scsi/ibmvscsi/ibmvfc.h
+@@ -33,7 +33,7 @@
+ #define IBMVFC_DRIVER_DATE "(August 14, 2008)"
+
+ #define IBMVFC_DEFAULT_TIMEOUT 15
+-#define IBMVFC_INIT_TIMEOUT 30
++#define IBMVFC_INIT_TIMEOUT 120
+ #define IBMVFC_MAX_REQUESTS_DEFAULT 100
+
+ #define IBMVFC_DEBUG 0
--- /dev/null
+From 18e6959c385f3edf3991fa6662a53dac4eb10d5b Mon Sep 17 00:00:00 2001
+From: Nick Piggin <npiggin@suse.de>
+Date: Wed, 14 Jan 2009 07:28:16 +0100
+Subject: mm: fix assertion
+
+From: Nick Piggin <npiggin@suse.de>
+
+commit 18e6959c385f3edf3991fa6662a53dac4eb10d5b upstream.
+
+This assertion is incorrect for lockless pagecache. By definition if we
+have an unpinned page that we are trying to take a speculative reference
+to, it may become the tail of a compound page at any time (if it is
+freed, then reallocated as a compound page).
+
+It was still a valid assertion for the vmscan.c LRU isolation case, but
+it doesn't seem incredibly helpful... if somebody wants it, they can
+put it back directly where it applies in the vmscan code.
+
+Signed-off-by: Nick Piggin <npiggin@suse.de>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ include/linux/mm.h | 1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/include/linux/mm.h
++++ b/include/linux/mm.h
+@@ -253,7 +253,6 @@ static inline int put_page_testzero(stru
+ */
+ static inline int get_page_unless_zero(struct page *page)
+ {
+- VM_BUG_ON(PageTail(page));
+ return atomic_inc_not_zero(&page->_count);
+ }
+
--- /dev/null
+From e8c82c2e23e3527e0c9dc195e432c16784d270fa Mon Sep 17 00:00:00 2001
+From: Nick Piggin <npiggin@suse.de>
+Date: Tue, 6 Jan 2009 03:05:50 +0100
+Subject: mm lockless pagecache barrier fix
+
+From: Nick Piggin <npiggin@suse.de>
+
+commit e8c82c2e23e3527e0c9dc195e432c16784d270fa upstream.
+
+An XFS workload showed up a bug in the lockless pagecache patch. Basically it
+would go into an "infinite" loop, although it would sometimes be able to break
+out of the loop! The reason is a missing compiler barrier in the "increment
+reference count unless it was zero" case of the lockless pagecache protocol in
+the gang lookup functions.
+
+This would cause the compiler to use a cached value of struct page pointer to
+retry the operation with, rather than reload it. So the page might have been
+removed from pagecache and freed (refcount==0) but the lookup would not correctly
+notice the page is no longer in pagecache, and keep attempting to increment the
+refcount and failing, until the page gets reallocated for something else. This
+isn't a data corruption because the condition will be detected if the page has
+been reallocated. However it can result in a lockup.
+
+Linus points out that ACCESS_ONCE is also required in that pointer load, even
+if it's absence is not causing a bug on our particular build. The most general
+way to solve this is just to put an rcu_dereference in radix_tree_deref_slot.
+
+Assembly of find_get_pages,
+before:
+.L220:
+ movq (%rbx), %rax #* ivtmp.1162, tmp82
+ movq (%rax), %rdi #, prephitmp.1149
+.L218:
+ testb $1, %dil #, prephitmp.1149
+ jne .L217 #,
+ testq %rdi, %rdi # prephitmp.1149
+ je .L203 #,
+ cmpq $-1, %rdi #, prephitmp.1149
+ je .L217 #,
+ movl 8(%rdi), %esi # <variable>._count.counter, c
+ testl %esi, %esi # c
+ je .L218 #,
+
+after:
+.L212:
+ movq (%rbx), %rax #* ivtmp.1109, tmp81
+ movq (%rax), %rdi #, ret
+ testb $1, %dil #, ret
+ jne .L211 #,
+ testq %rdi, %rdi # ret
+ je .L197 #,
+ cmpq $-1, %rdi #, ret
+ je .L211 #,
+ movl 8(%rdi), %esi # <variable>._count.counter, c
+ testl %esi, %esi # c
+ je .L212 #,
+
+(notice the obvious infinite loop in the first example, if page->count remains 0)
+
+Signed-off-by: Nick Piggin <npiggin@suse.de>
+Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ include/linux/radix-tree.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/include/linux/radix-tree.h
++++ b/include/linux/radix-tree.h
+@@ -136,7 +136,7 @@ do { \
+ */
+ static inline void *radix_tree_deref_slot(void **pslot)
+ {
+- void *ret = *pslot;
++ void *ret = rcu_dereference(*pslot);
+ if (unlikely(radix_tree_is_indirect_ptr(ret)))
+ ret = RADIX_TREE_RETRY;
+ return ret;
--- /dev/null
+From ddccf307a3599e452804e228d8ed30fba578923e Mon Sep 17 00:00:00 2001
+From: Reinhard Nissl <rnissl@gmx.de>
+Date: Thu, 11 Dec 2008 00:31:03 +0100
+Subject: [SCSI] mvsas: increase port type detection delay to suit Seagate's 10k6 drive ST3450856SS 0003
+
+From: Reinhard Nissl <rnissl@gmx.de>
+
+commit ddccf307a3599e452804e228d8ed30fba578923e upstream.
+
+I increased the delay step by step until loading of mvsas
+reliably detected the drive 200 times in sequence. A much better
+approach would be to monitor the hardware for some flag which
+indicates that port detection has finished, but I do not have any
+hardware documentation.
+
+Signed-off-by: Reinhard Nissl <rnissl@gmx.de>
+Cc: Ke Wei <kewei@marvell.com>
+Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/scsi/mvsas.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/scsi/mvsas.c
++++ b/drivers/scsi/mvsas.c
+@@ -2959,7 +2959,7 @@ static int __devinit mvs_hw_init(struct
+
+ /* enable auto port detection */
+ mw32(GBL_PORT_TYPE, MODE_AUTO_DET_EN);
+- msleep(100);
++ msleep(1100);
+ /* init and reset phys */
+ for (i = 0; i < mvi->chip->n_phy; i++) {
+ u32 lo = be32_to_cpu(*(u32 *)&mvi->sas_addr[4]);
--- /dev/null
+From 136221fc3219b3805c48db5da065e8e3467175d4 Mon Sep 17 00:00:00 2001
+From: Wu Fengguang <fengguang.wu@intel.com>
+Date: Tue, 23 Dec 2008 15:21:30 -0500
+Subject: nfs: remove redundant tests on reading new pages
+
+From: Wu Fengguang <fengguang.wu@intel.com>
+
+commit 136221fc3219b3805c48db5da065e8e3467175d4 upstream.
+
+aops->readpages() and its NFS helper readpage_async_filler() will only
+be called to do readahead I/O for newly allocated pages. So it's not
+necessary to test for the always 0 dirty/uptodate page flags.
+
+The removal of nfs_wb_page() call also fixes a readahead bug: the NFS
+readahead has been synchronous since 2.6.23, because that call will
+clear PG_readahead, which is the reminder for asynchronous readahead.
+
+More background: the PG_readahead page flag is shared with PG_reclaim,
+one for read path and the other for write path. clear_page_dirty_for_io()
+unconditionally clears PG_readahead to prevent possible readahead residuals,
+assuming itself to be always called in the write path. However, NFS is one
+and the only exception in that it _always_ calls clear_page_dirty_for_io()
+in the read path, i.e. for readpages()/readpage().
+
+Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
+Signed-off-by: Wu Fengguang <wfg@linux.intel.com>
+Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ fs/nfs/read.c | 6 ------
+ 1 file changed, 6 deletions(-)
+
+--- a/fs/nfs/read.c
++++ b/fs/nfs/read.c
+@@ -533,12 +533,6 @@ readpage_async_filler(void *data, struct
+ unsigned int len;
+ int error;
+
+- error = nfs_wb_page(inode, page);
+- if (error)
+- goto out_unlock;
+- if (PageUptodate(page))
+- goto out_unlock;
+-
+ len = nfs_page_length(page);
+ if (len == 0)
+ return nfs_return_empty_page(page);
--- /dev/null
+From 2218108e182fd8a6d9106077833ed7ad05fc8e75 Mon Sep 17 00:00:00 2001
+From: Brian King <brking@linux.vnet.ibm.com>
+Date: Thu, 18 Dec 2008 11:13:46 +0000
+Subject: powerpc: Disable Collaborative Memory Manager for kdump
+
+From: Brian King <brking@linux.vnet.ibm.com>
+
+commit 2218108e182fd8a6d9106077833ed7ad05fc8e75 upstream.
+
+When running Active Memory Sharing, the Collaborative Memory Manager
+(CMM) may mark some pages as "loaned" with the hypervisor.
+Periodically, the CMM will query the hypervisor for a loan request,
+which is a single signed value. When kexec'ing into a kdump kernel,
+the CMM driver in the kdump kernel is not aware of the pages the
+previous kernel had marked as "loaned", so the hypervisor and the CMM
+driver are out of sync. This results in the CMM driver getting a
+negative loan request, which can then get treated as a large unsigned
+value and can cause kdump to hang due to the CMM driver inflating too
+large. Since there really is no clean way for the CMM driver in the
+kdump kernel to clean this up, simply disable CMM in the kdump kernel.
+This fixes hangs we were seeing doing kdump with AMS.
+
+Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
+Signed-off-by: Paul Mackerras <paulus@samba.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/powerpc/platforms/pseries/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/powerpc/platforms/pseries/Kconfig
++++ b/arch/powerpc/platforms/pseries/Kconfig
+@@ -54,7 +54,7 @@ config PPC_SMLPAR
+
+ config CMM
+ tristate "Collaborative memory management"
+- depends on PPC_SMLPAR
++ depends on PPC_SMLPAR && !CRASH_DUMP
+ default y
+ help
+ Select this option, if you want to enable the kernel interface
0042--CVE-2009-0029-System-call-wrappers-part-32.patch
0043--CVE-2009-0029-System-call-wrappers-part-33.patch
0044--CVE-2009-0029-s390-specific-system-call-wrappers.patch
+e1000e-fix-ipmi-traffic.patch
+ecryptfs-check-readlink-result-was-not-an-error-before-using-it.patch
+fix-switch_names-breakage-in-short-to-short-case.patch
+fs-symlink-write_begin-allocation-context-fix.patch
+ibmvfc-delay-npiv-login-retry-and-add-retries.patch
+ibmvfc-improve-async-event-handling.patch
+mm-fix-assertion.patch
+mm-lockless-pagecache-barrier-fix.patch
+mvsas-increase-port-type-detection-delay-to-suit-seagate-s-10k6-drive-st3450856ss-0003.patch
+nfs-remove-redundant-tests-on-reading-new-pages.patch
+powerpc-disable-collaborative-memory-manager-for-kdump.patch
+usb-another-unusual_devs-entry-for-another-bad-argosy-storage-device.patch
+usb-storage-extend-unusual-range-for-067b-3507.patch
+usb-storage-recognizing-and-enabling-nokia-5200-cell-phoes.patch
+x86-avoid-theoretical-vmalloc-fault-loop.patch
+x86-cpa-dont-use-large-pages-for-kernel-identity-mapping-with-debug_pagealloc.patch
+x86-fix-rip-printout-in-early_idt_handler.patch
--- /dev/null
+From e2673b28911a43257265523e3672861be6e44093 Mon Sep 17 00:00:00 2001
+From: Nguyen Anh Quynh <aquynh@gmail.com>
+Date: Thu, 11 Dec 2008 15:04:11 -0800
+Subject: USB: another unusual_devs entry for another bad Argosy storage device
+
+From: Nguyen Anh Quynh <aquynh@gmail.com>
+
+commit e2673b28911a43257265523e3672861be6e44093 upstream.
+
+I have another Argosy USB storage device, which has the same problem
+with the Argosy USB storage device already fixed in 2.6.27.7. But this
+device has another product ID (840:84), so this patch adds a new entry
+into unusual_devs to fix the mount problem.
+
+I enclose here two patches: one against 2.6.27.8, and another against
+the latest linus-git tree.
+
+
+The information about the Argosy device is like below:
+
+#lsusb -v -d 840:84
+Bus 005 Device 005: ID 0840:0084 Argosy Research, Inc.
+Device Descriptor:
+ bLength 18
+ bDescriptorType 1
+ bcdUSB 2.00
+ bDeviceClass 0 (Defined at Interface level)
+ bDeviceSubClass 0
+ bDeviceProtocol 0
+ bMaxPacketSize0 64
+ idVendor 0x0840 Argosy Research, Inc.
+ idProduct 0x0084
+ bcdDevice 0.01
+ iManufacturer 1 Generic
+ iProduct 2 USB 2.0 Storage Device
+ iSerial 3 8400000000002549
+ bNumConfigurations 1
+ Configuration Descriptor:
+ bLength 9
+ bDescriptorType 2
+ wTotalLength 32
+ bNumInterfaces 1
+ bConfigurationValue 1
+ iConfiguration 0
+ bmAttributes 0xc0
+ Self Powered
+ MaxPower 2mA
+ Interface Descriptor:
+ bLength 9
+ bDescriptorType 4
+ bInterfaceNumber 0
+ bAlternateSetting 0
+ bNumEndpoints 2
+ bInterfaceClass 8 Mass Storage
+ bInterfaceSubClass 6 SCSI
+ bInterfaceProtocol 80 Bulk (Zip)
+ iInterface 0
+ Endpoint Descriptor:
+ bLength 7
+ bDescriptorType 5
+ bEndpointAddress 0x01 EP 1 OUT
+ bmAttributes 2
+ Transfer Type Bulk
+ Synch Type None
+ Usage Type Data
+ wMaxPacketSize 0x0200 1x 512 bytes
+ bInterval 0
+ Endpoint Descriptor:
+ bLength 7
+ bDescriptorType 5
+ bEndpointAddress 0x82 EP 2 IN
+ bmAttributes 2
+ Transfer Type Bulk
+ Synch Type None
+ Usage Type Data
+ wMaxPacketSize 0x0200 1x 512 bytes
+ bInterval 0
+Device Qualifier (for other device speed):
+ bLength 10
+ bDescriptorType 6
+ bcdUSB 2.00
+ bDeviceClass 0 (Defined at Interface level)
+ bDeviceSubClass 0
+ bDeviceProtocol 0
+ bMaxPacketSize0 64
+ bNumConfigurations 1
+Device Status: 0x0000
+ (Bus Powered)
+
+Before the patch, dmesg returns a lot of information like below (my
+dmesg is overflown):
+....
+[ 138.833390] sd 7:0:0:0: [sdb] Add. Sense: No additional sense information
+[ 138.877631] sd 7:0:0:0: [sdb] Sense Key : No Sense [current]
+[ 138.877643] sd 7:0:0:0: [sdb] Add. Sense: No additional sense information
+[ 138.921906] sd 7:0:0:0: [sdb] Sense Key : No Sense [current]
+[ 138.921923] sd 7:0:0:0: [sdb] Add. Sense: No additional sense information
+....
+
+After the fix, dmesg returns below information:
+....
+usb 5-1: new high speed USB device using ehci_hcd and address 5
+usb 5-1: configuration #1 chosen from 1 choice
+scsi7 : SCSI emulation for USB Mass Storage devices
+usb-storage: device found at 5
+usb-storage: waiting for device to settle before scanning
+usb-storage: device scan complete
+scsi 7:0:0:0: Direct-Access HTS54808 0M9AT00 MG4O PQ: 0 ANSI: 0
+sd 7:0:0:0: [sdb] 156301488 512-byte hardware sectors (80026 MB)
+sd 7:0:0:0: [sdb] Write Protect is off
+sd 7:0:0:0: [sdb] Mode Sense: 03 00 00 00
+sd 7:0:0:0: [sdb] Assuming drive cache: write through
+sd 7:0:0:0: [sdb] 156301488 512-byte hardware sectors (80026 MB)
+sd 7:0:0:0: [sdb] Write Protect is off
+sd 7:0:0:0: [sdb] Mode Sense: 03 00 00 00
+sd 7:0:0:0: [sdb] Assuming drive cache: write through
+ sdb: sdb1
+sd 7:0:0:0: [sdb] Attached SCSI disk
+sd 7:0:0:0: Attached scsi generic sg1 type 0
+kjournald starting. Commit interval 5 seconds
+EXT3 FS on sdb1, internal journal
+EXT3-fs: recovery complete.
+EXT3-fs: mounted filesystem with ordered data mode.
+
+Cc: Kuniyasu Suzaki <k.suzaki@aist.go.jp>
+Signed-off-by: Nguyen Anh Quynh <aquynh@gmail.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/storage/unusual_devs.h | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/drivers/usb/storage/unusual_devs.h
++++ b/drivers/usb/storage/unusual_devs.h
+@@ -1320,6 +1320,13 @@ UNUSUAL_DEV( 0x0840, 0x0082, 0x0001, 0x0
+ US_SC_DEVICE, US_PR_DEVICE, NULL,
+ US_FL_FIX_CAPACITY),
+
++/* Reported and patched by Nguyen Anh Quynh <aquynh@gmail.com> */
++UNUSUAL_DEV( 0x0840, 0x0084, 0x0001, 0x0001,
++ "Argosy",
++ "Storage",
++ US_SC_DEVICE, US_PR_DEVICE, NULL,
++ US_FL_FIX_CAPACITY),
++
+ /* Entry and supporting patch by Theodore Kilgore <kilgota@auburn.edu>.
+ * Flag will support Bulk devices which use a standards-violating 32-byte
+ * Command Block Wrapper. Here, the "DC2MEGA" cameras (several brands) with
--- /dev/null
+From b16363991414a6025beb7269f9c1dd294f9b241f Mon Sep 17 00:00:00 2001
+From: Oliver Neukum <oliver@neukum.org>
+Date: Fri, 12 Dec 2008 11:01:45 +0100
+Subject: USB: storage: extend unusual range for 067b:3507
+
+From: Oliver Neukum <oliver@neukum.org>
+
+commit b16363991414a6025beb7269f9c1dd294f9b241f upstream.
+
+This device has been released in a new revision which is still buggy.
+
+Signed-off-by: Oliver Neukum <oneukum@suse.de>
+Signed-off-by: Phil Dibowitz <phil@ipom.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/storage/unusual_devs.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/usb/storage/unusual_devs.h
++++ b/drivers/usb/storage/unusual_devs.h
+@@ -1040,7 +1040,7 @@ UNUSUAL_DEV( 0x067b, 0x2507, 0x0100, 0x0
+ US_FL_FIX_CAPACITY | US_FL_GO_SLOW ),
+
+ /* Reported by Alex Butcher <alex.butcher@assursys.co.uk> */
+-UNUSUAL_DEV( 0x067b, 0x3507, 0x0001, 0x0001,
++UNUSUAL_DEV( 0x067b, 0x3507, 0x0001, 0x0101,
+ "Prolific Technology Inc.",
+ "ATAPI-6 Bridge Controller",
+ US_SC_DEVICE, US_PR_DEVICE, NULL,
--- /dev/null
+From b8d23491f127aa0cd1863bd6cb58e771c558b762 Mon Sep 17 00:00:00 2001
+From: Paulo Afonso Graner Fessel <pfessel@gmail.com>
+Date: Fri, 12 Dec 2008 12:05:18 +0100
+Subject: USB: storage: recognizing and enabling Nokia 5200 cell phoes
+
+From: Paulo Afonso Graner Fessel <pfessel@gmail.com>
+
+commit b8d23491f127aa0cd1863bd6cb58e771c558b762 upstream.
+
+This patch corrects the issue when one connects a Nokia 5200 cell
+phone in data storage mode. If one uses an unpatched unusual_devs.h,
+the following messages appear on /var/log/messages:
+
+Dec 12 01:03:24 alberich kernel: usb 4-2: new full speed USB device
+using uhci_hcd and address 3
+Dec 12 01:03:25 alberich kernel: usb 4-2: configuration #1 chosen from 1 choice
+Dec 12 01:03:25 alberich kernel: scsi10 : SCSI emulation for USB Mass
+Storage devices
+Dec 12 01:03:25 alberich kernel: usb 4-2: New USB device found,
+idVendor=0421, idProduct=04bd
+Dec 12 01:03:25 alberich kernel: usb 4-2: New USB device strings:
+Mfr=1, Product=2, SerialNumber=3
+Dec 12 01:03:25 alberich kernel: usb 4-2: Product: Nokia 5200
+Dec 12 01:03:25 alberich kernel: usb 4-2: Manufacturer: Nokia
+Dec 12 01:03:25 alberich kernel: usb 4-2: SerialNumber: 353930018354523
+Dec 12 01:03:25 alberich kernel: usbcore: registered new interface driver ub
+Dec 12 01:03:30 alberich kernel: scsi 10:0:0:0: Direct-Access
+Nokia Nokia 5200 0000 PQ: 0 AN
+SI: 4
+Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] 3985409 512-byte
+hardware sectors (2041 MB)
+Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] Write Protect is off
+Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] Assuming drive
+cache: write through
+Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] 3985409 512-byte
+hardware sectors (2041 MB)
+Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] Write Protect is off
+Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] Assuming drive
+cache: write through
+Dec 12 01:03:30 alberich kernel: sdg: sdg1
+Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] Attached SCSI removable disk
+Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: Attached scsi generic sg9 type 0
+Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] Sense Key : No
+Sense [current]
+Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] Add. Sense: No
+additional sense information
+Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] Sense Key : No
+Sense [current]
+Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] Add. Sense: No
+additional sense information
+Dec 12 01:03:30 alberich kernel: sd 10:0:0:0: [sdg] Sense Key : No
+Sense [current]
+
+(...)
+
+The MicroSD card in the phone remains inaccessible and finally the
+cell phone turns itself off. The patch solves this problem and makes
+the cell phone fully accessible:
+
+[root@alberich kernel-linus-2.6.27.5-1mdv]# df -h
+Sist. Arq. Tam Usad Disp Uso% Montado em
+/dev/sda6 31G 5,2G 26G 17% /
+/dev/sda1 92M 27M 61M 31% /boot
+/dev/mapper/homevg-homelv 240G 237G 3,5G 99% /home
+/dev/sda3 21G 7,9G 13G 40% /mnt/windows
+/dev/sdg1 2,0G 287M 1,7G 15% /media/disk <--------
+
+I've found necessary to use the FL_US_CAPACITY_FIX switch, as without
+it the cell phone is recognized but it went berserk when performing
+low-level functions on it (a fdisk -l /dev/uba for example).
+
+lsusb -v output follows:
+
+Bus 004 Device 004: ID 0421:04bd Nokia Mobile Phones
+Device Descriptor:
+ bLength 18
+ bDescriptorType 1
+ bcdUSB 2.00
+ bDeviceClass 0 (Defined at Interface level)
+ bDeviceSubClass 0
+ bDeviceProtocol 0
+ bMaxPacketSize0 64
+ idVendor 0x0421 Nokia Mobile Phones
+ idProduct 0x04bd
+ bcdDevice 6.03
+ iManufacturer 1 Nokia
+ iProduct 2 Nokia 5200
+ iSerial 3 353930018354523
+ bNumConfigurations 1
+ Configuration Descriptor:
+ bLength 9
+ bDescriptorType 2
+ wTotalLength 32
+ bNumInterfaces 1
+ bConfigurationValue 1
+ iConfiguration 0
+ bmAttributes 0xc0
+ Self Powered
+ MaxPower 100mA
+ Interface Descriptor:
+ bLength 9
+ bDescriptorType 4
+ bInterfaceNumber 0
+ bAlternateSetting 0
+ bNumEndpoints 2
+ bInterfaceClass 8 Mass Storage
+ bInterfaceSubClass 6 SCSI
+ bInterfaceProtocol 80 Bulk (Zip)
+ iInterface 0
+ Endpoint Descriptor:
+ bLength 7
+ bDescriptorType 5
+ bEndpointAddress 0x81 EP 1 IN
+ bmAttributes 2
+ Transfer Type Bulk
+ Synch Type None
+ Usage Type Data
+ wMaxPacketSize 0x0040 1x 64 bytes
+ bInterval 0
+ Endpoint Descriptor:
+ bLength 7
+ bDescriptorType 5
+ bEndpointAddress 0x01 EP 1 OUT
+ bmAttributes 2
+ Transfer Type Bulk
+ Synch Type None
+ Usage Type Data
+ wMaxPacketSize 0x0040 1x 64 bytes
+ bInterval 0
+Device Status: 0x0001
+ Self Powered
+
+Signed-off-by: Paulo Afonso Graner Fessel <pfessel@gmail.com>
+Signed-off-by: Phil Dibowitz <phil@ipom.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/usb/storage/unusual_devs.h | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/drivers/usb/storage/unusual_devs.h
++++ b/drivers/usb/storage/unusual_devs.h
+@@ -246,6 +246,13 @@ UNUSUAL_DEV( 0x0421, 0x04b9, 0x0500, 0x
+ US_SC_DEVICE, US_PR_DEVICE, NULL,
+ US_FL_FIX_CAPACITY ),
+
++/* Reported by Paulo Fessel <pfessel@gmail.com> */
++UNUSUAL_DEV( 0x0421, 0x04bd, 0x0000, 0x9999,
++ "Nokia",
++ "5200",
++ US_SC_DEVICE, US_PR_DEVICE, NULL,
++ US_FL_FIX_CAPACITY ),
++
+ /* Reported by Richard Nauber <RichardNauber@web.de> */
+ UNUSUAL_DEV( 0x0421, 0x04fa, 0x0550, 0x0660,
+ "Nokia",
--- /dev/null
+From f313e12308f7c5ea645f18e759d104d088b18615 Mon Sep 17 00:00:00 2001
+From: Andi Kleen <andi@firstfloor.org>
+Date: Fri, 9 Jan 2009 12:17:43 -0800
+Subject: x86: avoid theoretical vmalloc fault loop
+
+From: Andi Kleen <andi@firstfloor.org>
+
+commit f313e12308f7c5ea645f18e759d104d088b18615 upstream.
+
+Ajith Kumar noticed:
+
+ I was going through the vmalloc fault handling for x86_64 and am unclear
+ about the following lines in the vmalloc_fault() function.
+
+ pgd = pgd_offset(current->mm ?: &init_mm, address);
+ pgd_ref = pgd_offset_k(address);
+
+ Here the intention is to get the pgd corresponding to the current process
+ and sync it up with the pgd in init_mm(obtained from pgd_offset_k).
+ However, for kernel threads current->mm is NULL and hence pgd =
+ pgd_offset(init_mm, address) = pgd_ref which means the fault handler
+ returns without setting the pgd entry in the MM structure in the context
+ of which the kernel thread has faulted. This could lead to never-ending
+ faults and busy looping of kernel threads like pdflush. So, shouldn't the
+ pgd = pgd_offset(current->mm ?: &init_mm, address); be pgd =
+ pgd_offset(current->active_mm ?: &init_mm, address);
+
+We can use active_mm unconditionally because it should be always set.
+
+Signed-off-by: Andi Kleen <ak@linux.intel.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Ingo Molnar <mingo@elte.hu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/x86/mm/fault.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/x86/mm/fault.c
++++ b/arch/x86/mm/fault.c
+@@ -534,7 +534,7 @@ static int vmalloc_fault(unsigned long a
+ happen within a race in page table update. In the later
+ case just flush. */
+
+- pgd = pgd_offset(current->mm ?: &init_mm, address);
++ pgd = pgd_offset(current->active_mm, address);
+ pgd_ref = pgd_offset_k(address);
+ if (pgd_none(*pgd_ref))
+ return -1;
--- /dev/null
+From 0b8fdcbcd287a1fbe66817491e6149841ae25705 Mon Sep 17 00:00:00 2001
+From: Suresh Siddha <suresh.b.siddha@intel.com>
+Date: Tue, 23 Sep 2008 14:00:39 -0700
+Subject: x86, cpa: dont use large pages for kernel identity mapping with DEBUG_PAGEALLOC
+
+From: Suresh Siddha <suresh.b.siddha@intel.com>
+
+commit 0b8fdcbcd287a1fbe66817491e6149841ae25705 upstream.
+
+Don't use large pages for kernel identity mapping with DEBUG_PAGEALLOC.
+This will remove the need to split the large page for the
+allocated kernel page in the interrupt context.
+
+This will simplify cpa code(as we don't do the split any more from the
+interrupt context). cpa code simplication in the subsequent patches.
+
+Tested-by: Tony Battersby <tonyb@cybernetics.com>
+Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
+Cc: Suresh Siddha <suresh.b.siddha@intel.com>
+Cc: arjan@linux.intel.com
+Cc: venkatesh.pallipadi@intel.com
+Cc: jeremy@goop.org
+Signed-off-by: Ingo Molnar <mingo@elte.hu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/x86/mm/init_32.c | 18 ++++++++++++++----
+ arch/x86/mm/init_64.c | 26 ++++++++++++++++++++------
+ 2 files changed, 34 insertions(+), 10 deletions(-)
+
+--- a/arch/x86/mm/init_32.c
++++ b/arch/x86/mm/init_32.c
+@@ -718,7 +718,7 @@ void __init setup_bootmem_allocator(void
+ after_init_bootmem = 1;
+ }
+
+-static void __init find_early_table_space(unsigned long end)
++static void __init find_early_table_space(unsigned long end, int use_pse)
+ {
+ unsigned long puds, pmds, ptes, tables, start;
+
+@@ -728,7 +728,7 @@ static void __init find_early_table_spac
+ pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
+ tables += PAGE_ALIGN(pmds * sizeof(pmd_t));
+
+- if (cpu_has_pse) {
++ if (use_pse) {
+ unsigned long extra;
+
+ extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT);
+@@ -768,12 +768,22 @@ unsigned long __init_refok init_memory_m
+ pgd_t *pgd_base = swapper_pg_dir;
+ unsigned long start_pfn, end_pfn;
+ unsigned long big_page_start;
++#ifdef CONFIG_DEBUG_PAGEALLOC
++ /*
++ * For CONFIG_DEBUG_PAGEALLOC, identity mapping will use small pages.
++ * This will simplify cpa(), which otherwise needs to support splitting
++ * large pages into small in interrupt context, etc.
++ */
++ int use_pse = 0;
++#else
++ int use_pse = cpu_has_pse;
++#endif
+
+ /*
+ * Find space for the kernel direct mapping tables.
+ */
+ if (!after_init_bootmem)
+- find_early_table_space(end);
++ find_early_table_space(end, use_pse);
+
+ #ifdef CONFIG_X86_PAE
+ set_nx();
+@@ -819,7 +829,7 @@ unsigned long __init_refok init_memory_m
+ end_pfn = (end>>PMD_SHIFT) << (PMD_SHIFT - PAGE_SHIFT);
+ if (start_pfn < end_pfn)
+ kernel_physical_mapping_init(pgd_base, start_pfn, end_pfn,
+- cpu_has_pse);
++ use_pse);
+
+ /* tail is not big page alignment ? */
+ start_pfn = end_pfn;
+--- a/arch/x86/mm/init_64.c
++++ b/arch/x86/mm/init_64.c
+@@ -446,13 +446,14 @@ phys_pud_update(pgd_t *pgd, unsigned lon
+ return phys_pud_init(pud, addr, end, page_size_mask);
+ }
+
+-static void __init find_early_table_space(unsigned long end)
++static void __init find_early_table_space(unsigned long end, int use_pse,
++ int use_gbpages)
+ {
+ unsigned long puds, pmds, ptes, tables, start;
+
+ puds = (end + PUD_SIZE - 1) >> PUD_SHIFT;
+ tables = round_up(puds * sizeof(pud_t), PAGE_SIZE);
+- if (direct_gbpages) {
++ if (use_gbpages) {
+ unsigned long extra;
+ extra = end - ((end>>PUD_SHIFT) << PUD_SHIFT);
+ pmds = (extra + PMD_SIZE - 1) >> PMD_SHIFT;
+@@ -460,7 +461,7 @@ static void __init find_early_table_spac
+ pmds = (end + PMD_SIZE - 1) >> PMD_SHIFT;
+ tables += round_up(pmds * sizeof(pmd_t), PAGE_SIZE);
+
+- if (cpu_has_pse) {
++ if (use_pse) {
+ unsigned long extra;
+ extra = end - ((end>>PMD_SHIFT) << PMD_SHIFT);
+ ptes = (extra + PAGE_SIZE - 1) >> PAGE_SHIFT;
+@@ -571,6 +572,7 @@ unsigned long __init_refok init_memory_m
+
+ struct map_range mr[NR_RANGE_MR];
+ int nr_range, i;
++ int use_pse, use_gbpages;
+
+ printk(KERN_INFO "init_memory_mapping\n");
+
+@@ -584,9 +586,21 @@ unsigned long __init_refok init_memory_m
+ if (!after_bootmem)
+ init_gbpages();
+
+- if (direct_gbpages)
++#ifdef CONFIG_DEBUG_PAGEALLOC
++ /*
++ * For CONFIG_DEBUG_PAGEALLOC, identity mapping will use small pages.
++ * This will simplify cpa(), which otherwise needs to support splitting
++ * large pages into small in interrupt context, etc.
++ */
++ use_pse = use_gbpages = 0;
++#else
++ use_pse = cpu_has_pse;
++ use_gbpages = direct_gbpages;
++#endif
++
++ if (use_gbpages)
+ page_size_mask |= 1 << PG_LEVEL_1G;
+- if (cpu_has_pse)
++ if (use_pse)
+ page_size_mask |= 1 << PG_LEVEL_2M;
+
+ memset(mr, 0, sizeof(mr));
+@@ -647,7 +661,7 @@ unsigned long __init_refok init_memory_m
+ (mr[i].page_size_mask & (1<<PG_LEVEL_2M))?"2M":"4k"));
+
+ if (!after_bootmem)
+- find_early_table_space(end);
++ find_early_table_space(end, use_pse, use_gbpages);
+
+ for (i = 0; i < nr_range; i++)
+ last_map_addr = kernel_physical_mapping_init(
--- /dev/null
+From 7aed55d1085f71241284a30af0300feea48c36db Mon Sep 17 00:00:00 2001
+From: Jiri Slaby <jirislaby@gmail.com>
+Date: Sun, 4 Jan 2009 00:27:09 +0100
+Subject: x86: fix RIP printout in early_idt_handler
+
+From: Jiri Slaby <jirislaby@gmail.com>
+
+commit 7aed55d1085f71241284a30af0300feea48c36db upstream.
+
+Impact: fix debug/crash printout
+
+Since errorcode is popped out, RIP is on the top of the stack.
+Use real RIP value instead of wrong CS.
+
+Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
+Signed-off-by: Ingo Molnar <mingo@elte.hu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/x86/kernel/head_64.S | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/x86/kernel/head_64.S
++++ b/arch/x86/kernel/head_64.S
+@@ -305,7 +305,7 @@ ENTRY(early_idt_handler)
+ call dump_stack
+ #ifdef CONFIG_KALLSYMS
+ leaq early_idt_ripmsg(%rip),%rdi
+- movq 8(%rsp),%rsi # get rip again
++ movq 0(%rsp),%rsi # get rip again
+ call __print_symbol
+ #endif
+ #endif /* EARLY_PRINTK */