]> git.pld-linux.org Git - packages/kernel.git/blob - kernel-small_fixes.patch
- avoid 30s xfs hangs
[packages/kernel.git] / kernel-small_fixes.patch
1 --- linux-2.6.32/drivers/infiniband/Kconfig~    2009-12-05 00:26:03.663774916 +0100
2 +++ linux-2.6.32/drivers/infiniband/Kconfig     2009-12-05 00:26:05.914179759 +0100
3 @@ -37,7 +37,6 @@
4  config INFINIBAND_ADDR_TRANS
5         bool
6         depends on INET
7 -       depends on !(INFINIBAND = y && IPV6 = m)
8         default y
9  
10  source "drivers/infiniband/hw/mthca/Kconfig"
11 --- linux-2.6.33/scripts/mod/modpost.c~ 2010-02-24 19:52:17.000000000 +0100
12 +++ linux-2.6.33/scripts/mod/modpost.c  2010-03-07 14:26:47.242168558 +0100
13 @@ -15,7 +15,8 @@
14  #include <stdio.h>
15  #include <ctype.h>
16  #include "modpost.h"
17 -#include "../../include/generated/autoconf.h"
18 +// PLD architectures don't use CONFIG_SYMBOL_PREFIX
19 +//#include "../../include/generated/autoconf.h"
20  #include "../../include/linux/license.h"
21  
22  /* Some toolchains use a `_' prefix for all user symbols. */
23
24 commit 87b09f1f25cd1e01d7c50bf423c7fe33027d7511
25 Author: stephen hemminger <shemminger@vyatta.com>
26 Date:   Fri Feb 12 06:58:00 2010 +0000
27
28     sky2: dont enable PME legacy mode
29     
30     This bit is not changed by vendor driver, and should be left alone.
31     The documentation implies this a debug bit.
32       0 = WAKE# only asserted when VMAIN not available
33       1 = WAKE# is depend on wake events and independent of VMAIN.
34     
35     Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
36     Signed-off-by: David S. Miller <davem@davemloft.net>
37
38 diff --git b/drivers/net/sky2.c a/drivers/net/sky2.c
39 index 2494842..edf37aa 100644
40 --- b/drivers/net/sky2.c
41 +++ a/drivers/net/sky2.c
42 @@ -733,6 +733,7 @@ static void sky2_wol_init(struct sky2_port *sky2)
43         unsigned port = sky2->port;
44         enum flow_control save_mode;
45         u16 ctrl;
46 +       u32 reg1;
47  
48         /* Bring hardware out of reset */
49         sky2_write16(hw, B0_CTST, CS_RST_CLR);
50 @@ -786,6 +787,11 @@ static void sky2_wol_init(struct sky2_port *sky2)
51         /* Disable PiG firmware */
52         sky2_write16(hw, B0_CTST, Y2_HW_WOL_OFF);
53  
54 +       /* Turn on legacy PCI-Express PME mode */
55 +       reg1 = sky2_pci_read32(hw, PCI_DEV_REG1);
56 +       reg1 |= PCI_Y2_PME_LEGACY;
57 +       sky2_pci_write32(hw, PCI_DEV_REG1, reg1);
58 +
59         /* block receiver */
60         sky2_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET);
61  }
62 On Sat, 2 Jul 2011, Andi Kleen wrote:
63
64 > > The problem is that blk_peek_request() calls scsi_prep_fn(), which 
65 > > does this:
66 > > 
67 > >     struct scsi_device *sdev = q->queuedata;
68 > >     int ret = BLKPREP_KILL;
69 > > 
70 > >     if (req->cmd_type == REQ_TYPE_BLOCK_PC)
71 > >             ret = scsi_setup_blk_pc_cmnd(sdev, req);
72 > >     return scsi_prep_return(q, req, ret);
73 > > 
74 > > It doesn't check to see if sdev is NULL, nor does 
75 > > scsi_setup_blk_pc_cmnd().  That accounts for this error:
76
77 > I actually added a NULL check in scsi_setup_blk_pc_cmnd early on,
78 > but that just caused RCU CPU stalls afterwards and then eventually
79 > a hung system.
80
81 The RCU problem is likely to be a separate issue.  It might even be a 
82 result of the use-after-free problem with the elevator.
83
84 At any rate, it's clear that the crash in the refcounting log you
85 posted occurred because scsi_setup_blk_pc_cmnd() called
86 scsi_prep_state_check(), which tried to dereference the NULL pointer.
87
88 Would you like to try this patch to see if it fixes the problem?  As I 
89 said before, I'm not certain it's the best thing to do, but it worked 
90 on my system.
91
92 Alan Stern
93
94
95
96
97 Index: usb-3.0/drivers/scsi/scsi_lib.c
98 ===================================================================
99 --- usb-3.0.orig/drivers/scsi/scsi_lib.c
100 +++ usb-3.0/drivers/scsi/scsi_lib.c
101 @@ -1247,6 +1247,8 @@ int scsi_prep_fn(struct request_queue *q
102         struct scsi_device *sdev = q->queuedata;
103         int ret = BLKPREP_KILL;
104  
105 +       if (!sdev)
106 +               return ret;
107         if (req->cmd_type == REQ_TYPE_BLOCK_PC)
108                 ret = scsi_setup_blk_pc_cmnd(sdev, req);
109         return scsi_prep_return(q, req, ret);
110 Index: usb-3.0/drivers/scsi/scsi_sysfs.c
111 ===================================================================
112 --- usb-3.0.orig/drivers/scsi/scsi_sysfs.c
113 +++ usb-3.0/drivers/scsi/scsi_sysfs.c
114 @@ -322,6 +322,8 @@ static void scsi_device_dev_release_user
115                 kfree(evt);
116         }
117  
118 +       /* Freeing the queue signals to block that we're done */
119 +       scsi_free_queue(sdev->request_queue);
120         blk_put_queue(sdev->request_queue);
121         /* NULL queue means the device can't be used */
122         sdev->request_queue = NULL;
123 @@ -936,8 +938,6 @@ void __scsi_remove_device(struct scsi_de
124         /* cause the request function to reject all I/O requests */
125         sdev->request_queue->queuedata = NULL;
126  
127 -       /* Freeing the queue signals to block that we're done */
128 -       scsi_free_queue(sdev->request_queue);
129         put_device(dev);
130  }
131  
132
133
134 --
135 To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
136 the body of a message to majordomo@vger.kernel.org
137 More majordomo info at  http://vger.kernel.org/majordomo-info.html
138 Please read the FAQ at  http://www.tux.org/lkml/
139 --- linux-3.0/scripts/kconfig/lxdialog/check-lxdialog.sh~       2011-07-22 04:17:23.000000000 +0200
140 +++ linux-3.0/scripts/kconfig/lxdialog/check-lxdialog.sh        2011-08-25 21:26:04.799150642 +0200
141 @@ -9,6 +9,12 @@
142                         $cc -print-file-name=lib${lib}.${ext} | grep -q /
143                         if [ $? -eq 0 ]; then
144                                 echo "-l${lib}"
145 +                               for libt in tinfow tinfo ; do
146 +                                       $cc -print-file-name=lib${libt}.${ext} | grep -q /
147 +                                       if [ $? -eq 0 ]; then
148 +                                               echo "-l${libt}"
149 +                                       fi
150 +                               done
151                                 exit
152                         fi
153                 done
154
155
156
157 commit 745718132c3c7cac98a622b610e239dcd5217f71
158 Author: Hannes Reinecke <hare@suse.de>
159 Date:   Wed Nov 9 08:39:24 2011 +0100
160
161     [SCSI] Silencing 'killing requests for dead queue'
162     
163     When we tear down a device we try to flush all outstanding
164     commands in scsi_free_queue(). However the check in
165     scsi_request_fn() is imperfect as it only signals that
166     we _might start_ aborting commands, not that we've actually
167     aborted some.
168     So move the printk inside the scsi_kill_request function,
169     this will also give us a hint about which commands are aborted.
170     
171     Signed-off-by: Hannes Reinecke <hare@suse.de>
172     Signed-off-by: James Bottomley <JBottomley@Parallels.com>
173
174 diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
175 index 06bc265..f85cfa6 100644
176 --- a/drivers/scsi/scsi_lib.c
177 +++ b/drivers/scsi/scsi_lib.c
178 @@ -1409,6 +1409,8 @@ static void scsi_kill_request(struct request *req, struct request_queue *q)
179  
180         blk_start_request(req);
181  
182 +       scmd_printk(KERN_INFO, cmd, "killing request\n");
183 +
184         sdev = cmd->device;
185         starget = scsi_target(sdev);
186         shost = sdev->host;
187 @@ -1490,7 +1492,6 @@ static void scsi_request_fn(struct request_queue *q)
188         struct request *req;
189  
190         if (!sdev) {
191 -               printk("scsi: killing requests for dead queue\n");
192                 while ((req = blk_peek_request(q)) != NULL)
193                         scsi_kill_request(req, q);
194                 return;
195 >From 4467601416e23740fc940c31b1fffacbcb69b4a0 Mon Sep 17 00:00:00 2001
196 From: Corey Minyard <cminyard@mvista.com>
197 Date: Mon, 21 Nov 2011 14:26:20 -0600
198 Subject: [PATCH] ipmi_watchdog: Restore settings when BMC reset
199
200 If the BMC gets reset, it will return 0x80 response errors.  In this case,
201 it is probably a good idea to restore the IPMI settings.
202 ---
203  drivers/char/ipmi/ipmi_watchdog.c |   41 ++++++++++++++++++++++++++++++++++--
204  1 files changed, 38 insertions(+), 3 deletions(-)
205
206 diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
207 index c2917ffa..34767a6 100644
208 --- a/drivers/char/ipmi/ipmi_watchdog.c
209 +++ b/drivers/char/ipmi/ipmi_watchdog.c
210 @@ -139,6 +139,8 @@
211  #define IPMI_WDOG_SET_TIMER            0x24
212  #define IPMI_WDOG_GET_TIMER            0x25
213  
214 +#define IPMI_WDOG_TIMER_NOT_INIT_RESP  0x80
215 +
216  /* These are here until the real ones get into the watchdog.h interface. */
217  #ifndef WDIOC_GETTIMEOUT
218  #define        WDIOC_GETTIMEOUT        _IOW(WATCHDOG_IOCTL_BASE, 20, int)
219 @@ -596,6 +598,7 @@ static int ipmi_heartbeat(void)
220         struct kernel_ipmi_msg            msg;
221         int                               rv;
222         struct ipmi_system_interface_addr addr;
223 +       int                               timeout_retries = 0;
224  
225         if (ipmi_ignore_heartbeat)
226                 return 0;
227 @@ -616,6 +619,7 @@ static int ipmi_heartbeat(void)
228  
229         mutex_lock(&heartbeat_lock);
230  
231 +restart:
232         atomic_set(&heartbeat_tofree, 2);
233  
234         /*
235 @@ -653,7 +657,33 @@ static int ipmi_heartbeat(void)
236         /* Wait for the heartbeat to be sent. */
237         wait_for_completion(&heartbeat_wait);
238  
239 -       if (heartbeat_recv_msg.msg.data[0] != 0) {
240 +       if (heartbeat_recv_msg.msg.data[0] == IPMI_WDOG_TIMER_NOT_INIT_RESP)  {
241 +               timeout_retries++;
242 +               if (timeout_retries > 3) {
243 +                       printk(KERN_ERR PFX ": Unable to restore the IPMI"
244 +                              " watchdog's settings, giving up.\n");
245 +                       rv = -EIO;
246 +                       goto out_unlock;
247 +               }
248 +
249 +               /*
250 +                * The timer was not initialized, that means the BMC was
251 +                * probably reset and lost the watchdog information.  Attempt
252 +                * to restore the timer's info.  Note that we still hold
253 +                * the heartbeat lock, to keep a heartbeat from happening
254 +                * in this process, so must say no heartbeat to avoid a
255 +                * deadlock on this mutex.
256 +                */
257 +               rv = ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB);
258 +               if (rv) {
259 +                       printk(KERN_ERR PFX ": Unable to send the command to"
260 +                              " set the watchdog's settings, giving up.\n");
261 +                       goto out_unlock;
262 +               }
263 +
264 +               /* We might need a new heartbeat, so do it now */
265 +               goto restart;
266 +       } else if (heartbeat_recv_msg.msg.data[0] != 0) {
267                 /*
268                  * Got an error in the heartbeat response.  It was already
269                  * reported in ipmi_wdog_msg_handler, but we should return
270 @@ -662,6 +692,7 @@ static int ipmi_heartbeat(void)
271                 rv = -EINVAL;
272         }
273  
274 +out_unlock:
275         mutex_unlock(&heartbeat_lock);
276  
277         return rv;
278 @@ -922,11 +953,15 @@ static struct miscdevice ipmi_wdog_miscdev = {
279  static void ipmi_wdog_msg_handler(struct ipmi_recv_msg *msg,
280                                   void                 *handler_data)
281  {
282 -       if (msg->msg.data[0] != 0) {
283 +       if (msg->msg.cmd == IPMI_WDOG_RESET_TIMER &&
284 +                       msg->msg.data[0] == IPMI_WDOG_TIMER_NOT_INIT_RESP)
285 +               printk(KERN_INFO PFX "response: The IPMI controller appears"
286 +                      " to have been reset, will attempt to reinitialize"
287 +                      " the watchdog timer\n");
288 +       else if (msg->msg.data[0] != 0)
289                 printk(KERN_ERR PFX "response: Error %x on cmd %x\n",
290                        msg->msg.data[0],
291                        msg->msg.cmd);
292 -       }
293  
294         ipmi_free_recv_msg(msg);
295  }
296 -- 
297 1.7.4.1
298
299 From: Christoph Hellwig <hch@lst.de>
300 Date: Tue, 29 Nov 2011 18:06:14 +0000 (-0600)
301 Subject: xfs: force buffer writeback before blocking on the ilock in inode reclaim
302 X-Git-Url: http://oss.sgi.com/cgi-bin/gitweb.cgi?p=xfs%2Fxfs.git;a=commitdiff_plain;h=4dd2cb4a28b7ab1f37163a4eba280926a13a8749
303
304 xfs: force buffer writeback before blocking on the ilock in inode reclaim
305
306 If we are doing synchronous inode reclaim we block the VM from making
307 progress in memory reclaim.  So if we encouter a flush locked inode
308 promote it in the delwri list and wake up xfsbufd to write it out now.
309 Without this we can get hangs of up to 30 seconds during workloads hitting
310 synchronous inode reclaim.
311
312 The scheme is copied from what we do for dquot reclaims.
313
314 Reported-by: Simon Kirby <sim@hostway.ca>
315 Signed-off-by: Christoph Hellwig <hch@lst.de>
316 Tested-by: Simon Kirby <sim@hostway.ca>
317 Signed-off-by: Ben Myers <bpm@sgi.com>
318 ---
319
320 diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
321 index c0237c6..755ee81 100644
322 --- a/fs/xfs/xfs_inode.c
323 +++ b/fs/xfs/xfs_inode.c
324 @@ -2835,6 +2835,27 @@ corrupt_out:
325         return XFS_ERROR(EFSCORRUPTED);
326  }
327  
328 +void
329 +xfs_promote_inode(
330 +       struct xfs_inode        *ip)
331 +{
332 +       struct xfs_buf          *bp;
333 +
334 +       ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL|XFS_ILOCK_SHARED));
335 +
336 +       bp = xfs_incore(ip->i_mount->m_ddev_targp, ip->i_imap.im_blkno,
337 +                       ip->i_imap.im_len, XBF_TRYLOCK);
338 +       if (!bp)
339 +               return;
340 +
341 +       if (XFS_BUF_ISDELAYWRITE(bp)) {
342 +               xfs_buf_delwri_promote(bp);
343 +               wake_up_process(ip->i_mount->m_ddev_targp->bt_task);
344 +       }
345 +
346 +       xfs_buf_relse(bp);
347 +}
348 +
349  /*
350   * Return a pointer to the extent record at file index idx.
351   */
352 diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h
353 index 760140d..b4cd473 100644
354 --- a/fs/xfs/xfs_inode.h
355 +++ b/fs/xfs/xfs_inode.h
356 @@ -498,6 +498,7 @@ int         xfs_iunlink(struct xfs_trans *, xfs_inode_t *);
357  void           xfs_iext_realloc(xfs_inode_t *, int, int);
358  void           xfs_iunpin_wait(xfs_inode_t *);
359  int            xfs_iflush(xfs_inode_t *, uint);
360 +void           xfs_promote_inode(struct xfs_inode *);
361  void           xfs_lock_inodes(xfs_inode_t **, int, uint);
362  void           xfs_lock_two_inodes(xfs_inode_t *, xfs_inode_t *, uint);
363  
364 diff --git a/fs/xfs/xfs_sync.c b/fs/xfs/xfs_sync.c
365 index aa3dc1a..be5c51d 100644
366 --- a/fs/xfs/xfs_sync.c
367 +++ b/fs/xfs/xfs_sync.c
368 @@ -770,6 +770,17 @@ restart:
369         if (!xfs_iflock_nowait(ip)) {
370                 if (!(sync_mode & SYNC_WAIT))
371                         goto out;
372 +
373 +               /*
374 +                * If we only have a single dirty inode in a cluster there is
375 +                * a fair chance that the AIL push may have pushed it into
376 +                * the buffer, but xfsbufd won't touch it until 30 seconds
377 +                * from now, and thus we will lock up here.
378 +                *
379 +                * Promote the inode buffer to the front of the delwri list
380 +                * and wake up xfsbufd now.
381 +                */
382 +               xfs_promote_inode(ip);
383                 xfs_iflock(ip);
384         }
385  
This page took 0.093313 seconds and 4 git commands to generate.