]> git.pld-linux.org Git - packages/kernel.git/blob - gcc13.patch
backport fixes for gcc 13
[packages/kernel.git] / gcc13.patch
1 From e6a71160cc145e18ab45195abf89884112e02dfb Mon Sep 17 00:00:00 2001
2 From: Kees Cook <keescook@chromium.org>
3 Date: Wed, 18 Jan 2023 12:21:35 -0800
4 Subject: gcc-plugins: Reorganize gimple includes for GCC 13
5
6 The gimple-iterator.h header must be included before gimple-fold.h
7 starting with GCC 13. Reorganize gimple headers to work for all GCC
8 versions.
9
10 Reported-by: Palmer Dabbelt <palmer@rivosinc.com>
11 Acked-by: Palmer Dabbelt <palmer@rivosinc.com>
12 Link: https://lore.kernel.org/all/20230113173033.4380-1-palmer@rivosinc.com/
13 Cc: linux-hardening@vger.kernel.org
14 Signed-off-by: Kees Cook <keescook@chromium.org>
15 ---
16  scripts/gcc-plugins/gcc-common.h | 4 ++--
17  1 file changed, 2 insertions(+), 2 deletions(-)
18
19 diff --git a/scripts/gcc-plugins/gcc-common.h b/scripts/gcc-plugins/gcc-common.h
20 index 9a1895747b153..84c730da36dd3 100644
21 --- a/scripts/gcc-plugins/gcc-common.h
22 +++ b/scripts/gcc-plugins/gcc-common.h
23 @@ -77,7 +77,9 @@
24  #include "varasm.h"
25  #include "stor-layout.h"
26  #include "internal-fn.h"
27 +#include "gimple.h"
28  #include "gimple-expr.h"
29 +#include "gimple-iterator.h"
30  #include "gimple-fold.h"
31  #include "context.h"
32  #include "tree-ssa-alias.h"
33 @@ -91,10 +93,8 @@
34  #include "tree-eh.h"
35  #include "stmt.h"
36  #include "gimplify.h"
37 -#include "gimple.h"
38  #include "tree-phinodes.h"
39  #include "tree-cfg.h"
40 -#include "gimple-iterator.h"
41  #include "gimple-ssa.h"
42  #include "ssa-iterators.h"
43  
44 -- 
45 cgit 
46
47 From ff1cc97b1f4c10db224f276d9615b22835b8c424 Mon Sep 17 00:00:00 2001
48 From: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
49 Date: Tue, 13 Dec 2022 13:08:26 +0100
50 Subject: block/blk-iocost (gcc13): keep large values in a new enum
51
52 Since gcc13, each member of an enum has the same type as the enum [1]. And
53 that is inherited from its members. Provided:
54   VTIME_PER_SEC_SHIFT     = 37,
55   VTIME_PER_SEC           = 1LLU << VTIME_PER_SEC_SHIFT,
56   ...
57   AUTOP_CYCLE_NSEC        = 10LLU * NSEC_PER_SEC,
58 the named type is unsigned long.
59
60 This generates warnings with gcc-13:
61   block/blk-iocost.c: In function 'ioc_weight_prfill':
62   block/blk-iocost.c:3037:37: error: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'long unsigned int'
63
64   block/blk-iocost.c: In function 'ioc_weight_show':
65   block/blk-iocost.c:3047:34: error: format '%u' expects argument of type 'unsigned int', but argument 3 has type 'long unsigned int'
66
67 So split the anonymous enum with large values to a separate enum, so
68 that they don't affect other members.
69
70 [1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=36113
71
72 Cc: Martin Liska <mliska@suse.cz>
73 Cc: Tejun Heo <tj@kernel.org>
74 Cc: Josef Bacik <josef@toxicpanda.com>
75 Cc: Jens Axboe <axboe@kernel.dk>
76 Cc: cgroups@vger.kernel.org
77 Cc: linux-block@vger.kernel.org
78 Signed-off-by: Jiri Slaby (SUSE) <jirislaby@kernel.org>
79 Link: https://lore.kernel.org/r/20221213120826.17446-1-jirislaby@kernel.org
80 Signed-off-by: Jens Axboe <axboe@kernel.dk>
81 ---
82  block/blk-iocost.c | 2 ++
83  1 file changed, 2 insertions(+)
84
85 (limited to 'block/blk-iocost.c')
86
87 diff --git a/block/blk-iocost.c b/block/blk-iocost.c
88 index d1bdc12deaa70..549ddc9e0c6f4 100644
89 --- a/block/blk-iocost.c
90 +++ b/block/blk-iocost.c
91 @@ -232,7 +232,9 @@ enum {
92  
93         /* 1/64k is granular enough and can easily be handled w/ u32 */
94         WEIGHT_ONE              = 1 << 16,
95 +};
96  
97 +enum {
98         /*
99          * As vtime is used to calculate the cost of each IO, it needs to
100          * be fairly high precision.  For example, it should be able to
101 -- 
102 cgit 
103
104 From 5f2779dfa7b8cc7dfd4a1b6586d86e0d193266f3 Mon Sep 17 00:00:00 2001
105 From: Arnd Bergmann <arnd@arndb.de>
106 Date: Wed, 18 Jan 2023 09:07:01 +0100
107 Subject: blk-iocost: avoid 64-bit division in ioc_timer_fn
108
109 The behavior of 'enum' types has changed in gcc-13, so now the
110 UNBUSY_THR_PCT constant is interpreted as a 64-bit number because
111 it is defined as part of the same enum definition as some other
112 constants that do not fit within a 32-bit integer. This in turn
113 leads to some inefficient code on 32-bit architectures as well
114 as a link error:
115
116 arm-linux-gnueabi/bin/arm-linux-gnueabi-ld: block/blk-iocost.o: in function `ioc_timer_fn':
117 blk-iocost.c:(.text+0x68e8): undefined reference to `__aeabi_uldivmod'
118 arm-linux-gnueabi-ld: blk-iocost.c:(.text+0x6908): undefined reference to `__aeabi_uldivmod'
119
120 Split the enum definition to keep the 64-bit timing constants in
121 a separate enum type from those constants that can clearly fit
122 within a smaller type.
123
124 Signed-off-by: Arnd Bergmann <arnd@arndb.de>
125 Acked-by: Tejun Heo <tj@kernel.org>
126 Link: https://lore.kernel.org/r/20230118080706.3303186-1-arnd@kernel.org
127 Signed-off-by: Jens Axboe <axboe@kernel.dk>
128 ---
129  block/blk-iocost.c | 8 +++++---
130  1 file changed, 5 insertions(+), 3 deletions(-)
131
132 (limited to 'block')
133
134 diff --git a/block/blk-iocost.c b/block/blk-iocost.c
135 index 6955605629e4f..b691b6bb498f3 100644
136 --- a/block/blk-iocost.c
137 +++ b/block/blk-iocost.c
138 @@ -258,6 +258,11 @@ enum {
139         VRATE_MIN               = VTIME_PER_USEC * VRATE_MIN_PPM / MILLION,
140         VRATE_CLAMP_ADJ_PCT     = 4,
141  
142 +       /* switch iff the conditions are met for longer than this */
143 +       AUTOP_CYCLE_NSEC        = 10LLU * NSEC_PER_SEC,
144 +};
145 +
146 +enum {
147         /* if IOs end up waiting for requests, issue less */
148         RQ_WAIT_BUSY_PCT        = 5,
149  
150 @@ -296,9 +301,6 @@ enum {
151         /* don't let cmds which take a very long time pin lagging for too long */
152         MAX_LAGGING_PERIODS     = 10,
153  
154 -       /* switch iff the conditions are met for longer than this */
155 -       AUTOP_CYCLE_NSEC        = 10LLU * NSEC_PER_SEC,
156 -
157         /*
158          * Count IO size in 4k pages.  The 12bit shift helps keeping
159          * size-proportional components of cost calculation in closer
160 -- 
161 cgit 
162
This page took 0.0631389999999999 seconds and 3 git commands to generate.