Skip to content

Commit 3907317

Browse files
authored
Merge pull request #274 from nathanchance/6.10.0-uprev
Update DEFAULT_KERNEL_FOR_PGO to 6.10.0
2 parents c2077a3 + 8b79236 commit 3907317

File tree

3 files changed

+105
-4
lines changed

3 files changed

+105
-4
lines changed

build-llvm.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
GOOD_REVISION = '15397583e3d85eb1f1a051de26eb409aaedd3b54'
1818

1919
# The version of the Linux kernel that the script downloads if necessary
20-
DEFAULT_KERNEL_FOR_PGO = (6, 9, 0)
20+
DEFAULT_KERNEL_FOR_PGO = (6, 10, 0)
2121

2222
parser = ArgumentParser(formatter_class=RawTextHelpFormatter)
2323
clone_options = parser.add_mutually_exclusive_group()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
From 2bac084468847cfe5bbc7166082b2a208514bb1c Mon Sep 17 00:00:00 2001
2+
From: Bill Wendling <[email protected]>
3+
Date: Wed, 29 May 2024 14:54:44 -0700
4+
Subject: drm/radeon: Remove __counted_by from StateArray.states[]
5+
6+
Work for __counted_by on generic pointers in structures (not just
7+
flexible array members) has started landing in Clang 19 (current tip of
8+
tree). During the development of this feature, a restriction was added
9+
to __counted_by to prevent the flexible array member's element type from
10+
including a flexible array member itself such as:
11+
12+
struct foo {
13+
int count;
14+
char buf[];
15+
};
16+
17+
struct bar {
18+
int count;
19+
struct foo data[] __counted_by(count);
20+
};
21+
22+
because the size of data cannot be calculated with the standard array
23+
size formula:
24+
25+
sizeof(struct foo) * count
26+
27+
This restriction was downgraded to a warning but due to CONFIG_WERROR,
28+
it can still break the build. The application of __counted_by on the
29+
states member of 'struct _StateArray' triggers this restriction,
30+
resulting in:
31+
32+
drivers/gpu/drm/radeon/pptable.h:442:5: error: 'counted_by' should not be applied to an array with element of unknown size because 'ATOM_PPLIB_STATE_V2' (aka 'struct _ATOM_PPLIB_STATE_V2') is a struct type with a flexible array member. This will be an error in a future compiler version [-Werror,-Wbounds-safety-counted-by-elt-type-unknown-size]
33+
442 | ATOM_PPLIB_STATE_V2 states[] __counted_by(ucNumEntries);
34+
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
35+
1 error generated.
36+
37+
Remove this use of __counted_by to fix the warning/error. However,
38+
rather than remove it altogether, leave it commented, as it may be
39+
possible to support this in future compiler releases.
40+
41+
42+
Closes: https://github.com/ClangBuiltLinux/linux/issues/2028
43+
Fixes: efade6fe50e7 ("drm/radeon: silence UBSAN warning (v3)")
44+
Signed-off-by: Bill Wendling <[email protected]>
45+
Co-developed-by: Nathan Chancellor <[email protected]>
46+
Signed-off-by: Nathan Chancellor <[email protected]>
47+
Signed-off-by: Alex Deucher <[email protected]>
48+
---
49+
Link: https://git.kernel.org/linus/2bac084468847cfe5bbc7166082b2a208514bb1c
50+
---
51+
drivers/gpu/drm/radeon/pptable.h | 2 +-
52+
1 file changed, 1 insertion(+), 1 deletion(-)
53+
54+
diff --git a/drivers/gpu/drm/radeon/pptable.h b/drivers/gpu/drm/radeon/pptable.h
55+
index b7f22597ee95e7..969a8fb0ee9e0b 100644
56+
--- a/drivers/gpu/drm/radeon/pptable.h
57+
+++ b/drivers/gpu/drm/radeon/pptable.h
58+
@@ -439,7 +439,7 @@ typedef struct _StateArray{
59+
//how many states we have
60+
UCHAR ucNumEntries;
61+
62+
- ATOM_PPLIB_STATE_V2 states[] __counted_by(ucNumEntries);
63+
+ ATOM_PPLIB_STATE_V2 states[] /* __counted_by(ucNumEntries) */;
64+
}StateArray;
65+
66+
67+
--
68+
cgit 1.2.3-korg
69+

tc_build/kernel.py

+35-3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from pathlib import Path
55
import shutil
66
import subprocess
7+
from tempfile import NamedTemporaryFile
78
import time
89

910
from tc_build.builder import Builder
@@ -23,7 +24,7 @@ def __init__(self, arch):
2324

2425
self.bolt_instrumentation = False
2526
self.bolt_sampling_output = None
26-
self.config_targets = None
27+
self.config_targets = []
2728
self.cross_compile = None
2829
self.make_variables = {
2930
'ARCH': arch,
@@ -60,6 +61,34 @@ def build(self):
6061
self.make_variables['LLVM_IAS'] = '0'
6162
self.make_variables['O'] = self.folders.build
6263

64+
self.clean_build_folder()
65+
66+
kconfig_allconfig = None
67+
# allmodconfig enables CONFIG_WERROR and other subsystem specific
68+
# -Werror configurations. Ensure all known configurations get disabled
69+
# via KCONFIG_ALLCONFIG, as they may override KCFLAGS=-Werror.
70+
if 'allmodconfig' in self.config_targets:
71+
self.folders.build.mkdir(parents=True)
72+
73+
# Using a context manager for this would seriously convolute this
74+
# code, as we need to use the name of the object in make_cmd but
75+
# delete it after actually running the command so the rest of the
76+
# code after this function would need another level of indent. We
77+
# know that from this point forward, the function can only throw an
78+
# exception when calling make_cmd, so we can just wrap that in a
79+
# try: ... finally: ... statement to ensure that this file is
80+
# always cleaned up.
81+
# pylint: disable-next=consider-using-with
82+
kconfig_allconfig = NamedTemporaryFile(dir=self.folders.build)
83+
84+
configs_to_disable = ['DRM_WERROR', 'WERROR']
85+
kconfig_allconfig_text = ''.join(f"CONFIG_{val}=n\n"
86+
for val in configs_to_disable).encode('utf-8')
87+
88+
kconfig_allconfig.write(kconfig_allconfig_text)
89+
kconfig_allconfig.seek(0)
90+
self.make_variables['KCONFIG_ALLCONFIG'] = kconfig_allconfig.name
91+
6392
make_cmd = []
6493
if self.bolt_sampling_output:
6594
make_cmd += [
@@ -77,9 +106,12 @@ def build(self):
77106
# Ideally, the kernel would always clobber user flags via ':=' but we deal with reality.
78107
os.environ.pop('CFLAGS', '')
79108

80-
self.clean_build_folder()
81109
build_start = time.time()
82-
self.run_cmd(make_cmd)
110+
try:
111+
self.run_cmd(make_cmd)
112+
finally:
113+
if kconfig_allconfig:
114+
kconfig_allconfig.close()
83115
tc_build.utils.print_info(f"Build duration: {tc_build.utils.get_duration(build_start)}")
84116

85117
def can_use_ias(self):

0 commit comments

Comments
 (0)