]> git.pld-linux.org Git - packages/kernel.git/blob - kernel-small_fixes.patch
59f4a4bb8cf5ec1c1b184699fc662e3264852e1f
[packages/kernel.git] / kernel-small_fixes.patch
1 --- linux-2.6.33/scripts/mod/modpost.c~ 2010-02-24 19:52:17.000000000 +0100
2 +++ linux-2.6.33/scripts/mod/modpost.c  2010-03-07 14:26:47.242168558 +0100
3 @@ -15,7 +15,8 @@
4  #include <stdio.h>
5  #include <ctype.h>
6  #include "modpost.h"
7 -#include "../../include/generated/autoconf.h"
8 +// PLD architectures don't use CONFIG_SYMBOL_PREFIX
9 +//#include "../../include/generated/autoconf.h"
10  #include "../../include/linux/license.h"
11  
12  /* Some toolchains use a `_' prefix for all user symbols. */
13
14 --- linux-3.0/scripts/kconfig/lxdialog/check-lxdialog.sh~       2011-07-22 04:17:23.000000000 +0200
15 +++ linux-3.0/scripts/kconfig/lxdialog/check-lxdialog.sh        2011-08-25 21:26:04.799150642 +0200
16 @@ -9,6 +9,12 @@
17                         $cc -print-file-name=lib${lib}.${ext} | grep -q /
18                         if [ $? -eq 0 ]; then
19                                 echo "-l${lib}"
20 +                               for libt in tinfow tinfo ; do
21 +                                       $cc -print-file-name=lib${libt}.${ext} | grep -q /
22 +                                       if [ $? -eq 0 ]; then
23 +                                               echo "-l${libt}"
24 +                                       fi
25 +                               done
26                                 exit
27                         fi
28                 done
29
30 diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
31 index 7a0c800..ec5ebbb 100644
32 --- a/drivers/net/ethernet/realtek/r8169.c
33 +++ b/drivers/net/ethernet/realtek/r8169.c
34 @@ -6927,6 +6927,14 @@ rtl_init_one(struct pci_dev *pdev, const
35         for (i = 0; i < ETH_ALEN; i++)
36                 dev->dev_addr[i] = RTL_R8(MAC0 + i);
37  
38 +       if (!is_valid_ether_addr(dev->dev_addr)) {
39 +               /* Report it and use a random ethernet address instead */
40 +               netdev_err(dev, "Invalid MAC address: %pM\n", dev->dev_addr);
41 +               random_ether_addr(dev->dev_addr);
42 +               netdev_info(dev, "Using random MAC address: %pM\n",
43 +                               dev->dev_addr);
44 +       }
45 +
46         SET_ETHTOOL_OPS(dev, &rtl8169_ethtool_ops);
47         dev->watchdog_timeo = RTL8169_TX_TIMEOUT;
48  
49 commit 110dc24ad2ae4e9b94b08632fe1eb2fcdff83045
50 Author: Dave Chinner <dchinner@redhat.com>
51 Date:   Tue May 20 08:18:09 2014 +1000
52
53     xfs: log vector rounding leaks log space
54     
55     The addition of direct formatting of log items into the CIL
56     linear buffer added alignment restrictions that the start of each
57     vector needed to be 64 bit aligned. Hence padding was added in
58     xlog_finish_iovec() to round up the vector length to ensure the next
59     vector started with the correct alignment.
60     
61     This adds a small number of bytes to the size of
62     the linear buffer that is otherwise unused. The issue is that we
63     then use the linear buffer size to determine the log space used by
64     the log item, and this includes the unused space. Hence when we
65     account for space used by the log item, it's more than is actually
66     written into the iclogs, and hence we slowly leak this space.
67     
68     This results on log hangs when reserving space, with threads getting
69     stuck with these stack traces:
70     
71     Call Trace:
72     [<ffffffff81d15989>] schedule+0x29/0x70
73     [<ffffffff8150d3a2>] xlog_grant_head_wait+0xa2/0x1a0
74     [<ffffffff8150d55d>] xlog_grant_head_check+0xbd/0x140
75     [<ffffffff8150ee33>] xfs_log_reserve+0x103/0x220
76     [<ffffffff814b7f05>] xfs_trans_reserve+0x2f5/0x310
77     .....
78     
79     The 4 bytes is significant. Brain Foster did all the hard work in
80     tracking down a reproducable leak to inode chunk allocation (it went
81     away with the ikeep mount option). His rough numbers were that
82     creating 50,000 inodes leaked 11 log blocks. This turns out to be
83     roughly 800 inode chunks or 1600 inode cluster buffers. That
84     works out at roughly 4 bytes per cluster buffer logged, and at that
85     I started looking for a 4 byte leak in the buffer logging code.
86     
87     What I found was that a struct xfs_buf_log_format structure for an
88     inode cluster buffer is 28 bytes in length. This gets rounded up to
89     32 bytes, but the vector length remains 28 bytes. Hence the CIL
90     ticket reservation is decremented by 32 bytes (via lv->lv_buf_len)
91     for that vector rather than 28 bytes which are written into the log.
92     
93     The fix for this problem is to separately track the bytes used by
94     the log vectors in the item and use that instead of the buffer
95     length when accounting for the log space that will be used by the
96     formatted log item.
97     
98     Again, thanks to Brian Foster for doing all the hard work and long
99     hours to isolate this leak and make finding the bug relatively
100     simple.
101     
102     Signed-off-by: Dave Chinner <dchinner@redhat.com>
103     Reviewed-by: Christoph Hellwig <hch@lst.de>
104     Reviewed-by: Brian Foster <bfoster@redhat.com>
105     Signed-off-by: Dave Chinner <david@fromorbit.com>
106
107 diff --git a/fs/xfs/xfs_log.h b/fs/xfs/xfs_log.h
108 index 2c40044..84e0deb 100644
109 --- a/fs/xfs/xfs_log.h
110 +++ b/fs/xfs/xfs_log.h
111 @@ -24,7 +24,8 @@ struct xfs_log_vec {
112         struct xfs_log_iovec    *lv_iovecp;     /* iovec array */
113         struct xfs_log_item     *lv_item;       /* owner */
114         char                    *lv_buf;        /* formatted buffer */
115 -       int                     lv_buf_len;     /* size of formatted buffer */
116 +       int                     lv_bytes;       /* accounted space in buffer */
117 +       int                     lv_buf_len;     /* aligned size of buffer */
118         int                     lv_size;        /* size of allocated lv */
119  };
120  
121 @@ -52,15 +53,21 @@ xlog_prepare_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec **vecp,
122         return vec->i_addr;
123  }
124  
125 +/*
126 + * We need to make sure the next buffer is naturally aligned for the biggest
127 + * basic data type we put into it.  We already accounted for this padding when
128 + * sizing the buffer.
129 + *
130 + * However, this padding does not get written into the log, and hence we have to
131 + * track the space used by the log vectors separately to prevent log space hangs
132 + * due to inaccurate accounting (i.e. a leak) of the used log space through the
133 + * CIL context ticket.
134 + */
135  static inline void
136  xlog_finish_iovec(struct xfs_log_vec *lv, struct xfs_log_iovec *vec, int len)
137  {
138 -       /*
139 -        * We need to make sure the next buffer is naturally aligned for the
140 -        * biggest basic data type we put into it.  We already accounted for
141 -        * this when sizing the buffer.
142 -        */
143         lv->lv_buf_len += round_up(len, sizeof(uint64_t));
144 +       lv->lv_bytes += len;
145         vec->i_len = len;
146  }
147  
148 diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
149 index 7e54553..de835da 100644
150 --- a/fs/xfs/xfs_log_cil.c
151 +++ b/fs/xfs/xfs_log_cil.c
152 @@ -97,7 +97,7 @@ xfs_cil_prepare_item(
153  {
154         /* Account for the new LV being passed in */
155         if (lv->lv_buf_len != XFS_LOG_VEC_ORDERED) {
156 -               *diff_len += lv->lv_buf_len;
157 +               *diff_len += lv->lv_bytes;
158                 *diff_iovecs += lv->lv_niovecs;
159         }
160  
161 @@ -111,7 +111,7 @@ xfs_cil_prepare_item(
162         else if (old_lv != lv) {
163                 ASSERT(lv->lv_buf_len != XFS_LOG_VEC_ORDERED);
164  
165 -               *diff_len -= old_lv->lv_buf_len;
166 +               *diff_len -= old_lv->lv_bytes;
167                 *diff_iovecs -= old_lv->lv_niovecs;
168                 kmem_free(old_lv);
169         }
170 @@ -239,7 +239,7 @@ xlog_cil_insert_format_items(
171                          * that the space reservation accounting is correct.
172                          */
173                         *diff_iovecs -= lv->lv_niovecs;
174 -                       *diff_len -= lv->lv_buf_len;
175 +                       *diff_len -= lv->lv_bytes;
176                 } else {
177                         /* allocate new data chunk */
178                         lv = kmem_zalloc(buf_size, KM_SLEEP|KM_NOFS);
179 @@ -259,6 +259,7 @@ xlog_cil_insert_format_items(
180  
181                 /* The allocated data region lies beyond the iovec region */
182                 lv->lv_buf_len = 0;
183 +               lv->lv_bytes = 0;
184                 lv->lv_buf = (char *)lv + buf_size - nbytes;
185                 ASSERT(IS_ALIGNED((unsigned long)lv->lv_buf, sizeof(uint64_t)));
186  
This page took 0.039698 seconds and 2 git commands to generate.