Skip to content

Commit 80955ae

Browse files
committed
Merge tag 'driver-core-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core updates from Greg KH: "Here are the set of driver core and kernfs changes for 6.8-rc1. Nothing major in here this release cycle, just lots of small cleanups and some tweaks on kernfs that in the very end, got reverted and will come back in a safer way next release cycle. Included in here are: - more driver core 'const' cleanups and fixes - fw_devlink=rpm is now the default behavior - kernfs tiny changes to remove some string functions - cpu handling in the driver core is updated to work better on many systems that add topologies and cpus after booting - other minor changes and cleanups All of the cpu handling patches have been acked by the respective maintainers and are coming in here in one series. Everything has been in linux-next for a while with no reported issues" * tag 'driver-core-6.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (51 commits) Revert "kernfs: convert kernfs_idr_lock to an irq safe raw spinlock" kernfs: convert kernfs_idr_lock to an irq safe raw spinlock class: fix use-after-free in class_register() PM: clk: make pm_clk_add_notifier() take a const pointer EDAC: constantify the struct bus_type usage kernfs: fix reference to renamed function driver core: device.h: fix Excess kernel-doc description warning driver core: class: fix Excess kernel-doc description warning driver core: mark remaining local bus_type variables as const driver core: container: make container_subsys const driver core: bus: constantify subsys_register() calls driver core: bus: make bus_sort_breadthfirst() take a const pointer kernfs: d_obtain_alias(NULL) will do the right thing... driver core: Better advertise dev_err_probe() kernfs: Convert kernfs_path_from_node_locked() from strlcpy() to strscpy() kernfs: Convert kernfs_name_locked() from strlcpy() to strscpy() kernfs: Convert kernfs_walk_ns() from strlcpy() to strscpy() initramfs: Expose retained initrd as sysfs file fs/kernfs/dir: obey S_ISGID kernel/cgroup: use kernfs_create_dir_ns() ...
2 parents 296455a + e3977e0 commit 80955ae

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+207
-253
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
What: /sys/firmware/initrd
2+
Date: December 2023
3+
Contact: Alexander Graf <[email protected]>
4+
Description:
5+
When the kernel was booted with an initrd and the
6+
"retain_initrd" option is set on the kernel command
7+
line, /sys/firmware/initrd contains the contents of the
8+
initrd that the kernel was booted with.

Documentation/admin-guide/kernel-parameters.txt

+3-2
Original file line numberDiff line numberDiff line change
@@ -2449,7 +2449,7 @@
24492449
between unregistering the boot console and initializing
24502450
the real console.
24512451

2452-
keepinitrd [HW,ARM]
2452+
keepinitrd [HW,ARM] See retain_initrd.
24532453

24542454
kernelcore= [KNL,X86,IA-64,PPC]
24552455
Format: nn[KMGTPE] | nn% | "mirror"
@@ -5604,7 +5604,8 @@
56045604
Useful for devices that are detected asynchronously
56055605
(e.g. USB and MMC devices).
56065606

5607-
retain_initrd [RAM] Keep initrd memory after extraction
5607+
retain_initrd [RAM] Keep initrd memory after extraction. After boot, it will
5608+
be accessible via /sys/firmware/initrd.
56085609

56095610
retbleed= [X86] Control mitigation of RETBleed (Arbitrary
56105611
Speculative Code Execution with Return Instructions)

arch/arm64/Kconfig

+1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ config ARM64
133133
select GENERIC_ARCH_TOPOLOGY
134134
select GENERIC_CLOCKEVENTS_BROADCAST
135135
select GENERIC_CPU_AUTOPROBE
136+
select GENERIC_CPU_DEVICES
136137
select GENERIC_CPU_VULNERABILITIES
137138
select GENERIC_EARLY_IOREMAP
138139
select GENERIC_IDLE_POLL_SETUP

arch/arm64/include/asm/cpu.h

-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ struct cpuinfo_32bit {
3838
};
3939

4040
struct cpuinfo_arm64 {
41-
struct cpu cpu;
4241
struct kobject kobj;
4342
u64 reg_ctr;
4443
u64 reg_cntfrq;

arch/arm64/kernel/setup.c

+2-11
Original file line numberDiff line numberDiff line change
@@ -402,19 +402,10 @@ static inline bool cpu_can_disable(unsigned int cpu)
402402
return false;
403403
}
404404

405-
static int __init topology_init(void)
405+
bool arch_cpu_is_hotpluggable(int num)
406406
{
407-
int i;
408-
409-
for_each_possible_cpu(i) {
410-
struct cpu *cpu = &per_cpu(cpu_data.cpu, i);
411-
cpu->hotpluggable = cpu_can_disable(i);
412-
register_cpu(cpu, i);
413-
}
414-
415-
return 0;
407+
return cpu_can_disable(num);
416408
}
417-
subsys_initcall(topology_init);
418409

419410
static void dump_kernel_offset(void)
420411
{

arch/loongarch/Kconfig

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ config LOONGARCH
55
select ACPI
66
select ACPI_GENERIC_GSI if ACPI
77
select ACPI_MCFG if ACPI
8+
select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR && HOTPLUG_CPU
89
select ACPI_PPTT if ACPI
910
select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
1011
select ARCH_BINFMT_ELF_STATE
@@ -71,6 +72,7 @@ config LOONGARCH
7172
select GENERIC_CLOCKEVENTS
7273
select GENERIC_CMOS_UPDATE
7374
select GENERIC_CPU_AUTOPROBE
75+
select GENERIC_CPU_DEVICES
7476
select GENERIC_ENTRY
7577
select GENERIC_GETTIMEOFDAY
7678
select GENERIC_IOREMAP if !ARCH_IOREMAP

arch/loongarch/kernel/topology.c

+2-40
Original file line numberDiff line numberDiff line change
@@ -10,47 +10,9 @@
1010

1111
#include <acpi/processor.h>
1212

13-
static DEFINE_PER_CPU(struct cpu, cpu_devices);
14-
1513
#ifdef CONFIG_HOTPLUG_CPU
16-
int arch_register_cpu(int cpu)
14+
bool arch_cpu_is_hotpluggable(int cpu)
1715
{
18-
int ret;
19-
struct cpu *c = &per_cpu(cpu_devices, cpu);
20-
21-
c->hotpluggable = 1;
22-
ret = register_cpu(c, cpu);
23-
if (ret < 0)
24-
pr_warn("register_cpu %d failed (%d)\n", cpu, ret);
25-
26-
return ret;
27-
}
28-
EXPORT_SYMBOL(arch_register_cpu);
29-
30-
void arch_unregister_cpu(int cpu)
31-
{
32-
struct cpu *c = &per_cpu(cpu_devices, cpu);
33-
34-
c->hotpluggable = 0;
35-
unregister_cpu(c);
16+
return !io_master(cpu);
3617
}
37-
EXPORT_SYMBOL(arch_unregister_cpu);
3818
#endif
39-
40-
static int __init topology_init(void)
41-
{
42-
int i, ret;
43-
44-
for_each_present_cpu(i) {
45-
struct cpu *c = &per_cpu(cpu_devices, i);
46-
47-
c->hotpluggable = !io_master(i);
48-
ret = register_cpu(c, i);
49-
if (ret < 0)
50-
pr_warn("topology_init: register_cpu %d failed (%d)\n", i, ret);
51-
}
52-
53-
return 0;
54-
}
55-
56-
subsys_initcall(topology_init);

arch/riscv/Kconfig

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ config RISCV
7272
select GENERIC_ARCH_TOPOLOGY
7373
select GENERIC_ATOMIC64 if !64BIT
7474
select GENERIC_CLOCKEVENTS_BROADCAST if SMP
75+
select GENERIC_CPU_DEVICES
7576
select GENERIC_EARLY_IOREMAP
7677
select GENERIC_ENTRY
7778
select GENERIC_GETTIMEOFDAY if HAVE_GENERIC_VDSO

arch/riscv/kernel/setup.c

+2-16
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ atomic_t hart_lottery __section(".sdata")
5050
#endif
5151
;
5252
unsigned long boot_cpu_hartid;
53-
static DEFINE_PER_CPU(struct cpu, cpu_devices);
5453

5554
/*
5655
* Place kernel memory regions on the resource tree so that
@@ -298,23 +297,10 @@ void __init setup_arch(char **cmdline_p)
298297
riscv_user_isa_enable();
299298
}
300299

301-
static int __init topology_init(void)
300+
bool arch_cpu_is_hotpluggable(int cpu)
302301
{
303-
int i, ret;
304-
305-
for_each_possible_cpu(i) {
306-
struct cpu *cpu = &per_cpu(cpu_devices, i);
307-
308-
cpu->hotpluggable = cpu_has_hotplug(i);
309-
ret = register_cpu(cpu, i);
310-
if (unlikely(ret))
311-
pr_warn("Warning: %s: register_cpu %d failed (%d)\n",
312-
__func__, i, ret);
313-
}
314-
315-
return 0;
302+
return cpu_has_hotplug(cpu);
316303
}
317-
subsys_initcall(topology_init);
318304

319305
void free_initmem(void)
320306
{

arch/x86/Kconfig

+2
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ config X86
5959
#
6060
select ACPI_LEGACY_TABLES_LOOKUP if ACPI
6161
select ACPI_SYSTEM_POWER_STATES_SUPPORT if ACPI
62+
select ACPI_HOTPLUG_CPU if ACPI_PROCESSOR && HOTPLUG_CPU
6263
select ARCH_32BIT_OFF_T if X86_32
6364
select ARCH_CLOCKSOURCE_INIT
6465
select ARCH_CORRECT_STACKTRACE_ON_KRETPROBE
@@ -148,6 +149,7 @@ config X86
148149
select GENERIC_CLOCKEVENTS_MIN_ADJUST
149150
select GENERIC_CMOS_UPDATE
150151
select GENERIC_CPU_AUTOPROBE
152+
select GENERIC_CPU_DEVICES
151153
select GENERIC_CPU_VULNERABILITIES
152154
select GENERIC_EARLY_IOREMAP
153155
select GENERIC_ENTRY

arch/x86/include/asm/cpu.h

-4
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ static inline void prefill_possible_map(void) {}
2323

2424
#endif /* CONFIG_SMP */
2525

26-
struct x86_cpu {
27-
struct cpu cpu;
28-
};
29-
3026
#ifdef CONFIG_HOTPLUG_CPU
3127
extern void soft_restart_cpu(void);
3228
#endif

arch/x86/kernel/topology.c

+2-31
Original file line numberDiff line numberDiff line change
@@ -35,38 +35,9 @@
3535
#include <asm/io_apic.h>
3636
#include <asm/cpu.h>
3737

38-
static DEFINE_PER_CPU(struct x86_cpu, cpu_devices);
39-
4038
#ifdef CONFIG_HOTPLUG_CPU
41-
int arch_register_cpu(int cpu)
39+
bool arch_cpu_is_hotpluggable(int cpu)
4240
{
43-
struct x86_cpu *xc = per_cpu_ptr(&cpu_devices, cpu);
44-
45-
xc->cpu.hotpluggable = cpu > 0;
46-
return register_cpu(&xc->cpu, cpu);
47-
}
48-
EXPORT_SYMBOL(arch_register_cpu);
49-
50-
void arch_unregister_cpu(int num)
51-
{
52-
unregister_cpu(&per_cpu(cpu_devices, num).cpu);
53-
}
54-
EXPORT_SYMBOL(arch_unregister_cpu);
55-
#else /* CONFIG_HOTPLUG_CPU */
56-
57-
int __init arch_register_cpu(int num)
58-
{
59-
return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
41+
return cpu > 0;
6042
}
6143
#endif /* CONFIG_HOTPLUG_CPU */
62-
63-
static int __init topology_init(void)
64-
{
65-
int i;
66-
67-
for_each_present_cpu(i)
68-
arch_register_cpu(i);
69-
70-
return 0;
71-
}
72-
subsys_initcall(topology_init);

drivers/acpi/Kconfig

-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,6 @@ config ACPI_HOTPLUG_CPU
314314
bool
315315
depends on ACPI_PROCESSOR && HOTPLUG_CPU
316316
select ACPI_CONTAINER
317-
default y
318317

319318
config ACPI_PROCESSOR_AGGREGATOR
320319
tristate "Processor Aggregator"

drivers/acpi/acpi_processor.c

-18
Original file line numberDiff line numberDiff line change
@@ -184,24 +184,6 @@ static void __init acpi_pcc_cpufreq_init(void) {}
184184

185185
/* Initialization */
186186
#ifdef CONFIG_ACPI_HOTPLUG_CPU
187-
int __weak acpi_map_cpu(acpi_handle handle,
188-
phys_cpuid_t physid, u32 acpi_id, int *pcpu)
189-
{
190-
return -ENODEV;
191-
}
192-
193-
int __weak acpi_unmap_cpu(int cpu)
194-
{
195-
return -ENODEV;
196-
}
197-
198-
int __weak arch_register_cpu(int cpu)
199-
{
200-
return -ENODEV;
201-
}
202-
203-
void __weak arch_unregister_cpu(int cpu) {}
204-
205187
static int acpi_processor_hotadd_init(struct acpi_processor *pr)
206188
{
207189
unsigned long long sta;

drivers/acpi/property.c

+4
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,7 @@ static struct fwnode_handle *acpi_parse_string_ref(const struct fwnode_handle *f
881881
* @index: Index of the reference to return
882882
* @num_args: Maximum number of arguments after each reference
883883
* @args: Location to store the returned reference with optional arguments
884+
* (may be NULL)
884885
*
885886
* Find property with @name, verifify that it is a package containing at least
886887
* one object reference and if so, store the ACPI device object pointer to the
@@ -938,6 +939,9 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
938939
if (!device)
939940
return -EINVAL;
940941

942+
if (!args)
943+
return 0;
944+
941945
args->fwnode = acpi_fwnode_handle(device);
942946
args->nargs = 0;
943947

drivers/base/arch_topology.c

+26-12
Original file line numberDiff line numberDiff line change
@@ -219,20 +219,34 @@ static DECLARE_WORK(update_topology_flags_work, update_topology_flags_workfn);
219219

220220
static DEVICE_ATTR_RO(cpu_capacity);
221221

222-
static int register_cpu_capacity_sysctl(void)
222+
static int cpu_capacity_sysctl_add(unsigned int cpu)
223223
{
224-
int i;
225-
struct device *cpu;
224+
struct device *cpu_dev = get_cpu_device(cpu);
226225

227-
for_each_possible_cpu(i) {
228-
cpu = get_cpu_device(i);
229-
if (!cpu) {
230-
pr_err("%s: too early to get CPU%d device!\n",
231-
__func__, i);
232-
continue;
233-
}
234-
device_create_file(cpu, &dev_attr_cpu_capacity);
235-
}
226+
if (!cpu_dev)
227+
return -ENOENT;
228+
229+
device_create_file(cpu_dev, &dev_attr_cpu_capacity);
230+
231+
return 0;
232+
}
233+
234+
static int cpu_capacity_sysctl_remove(unsigned int cpu)
235+
{
236+
struct device *cpu_dev = get_cpu_device(cpu);
237+
238+
if (!cpu_dev)
239+
return -ENOENT;
240+
241+
device_remove_file(cpu_dev, &dev_attr_cpu_capacity);
242+
243+
return 0;
244+
}
245+
246+
static int register_cpu_capacity_sysctl(void)
247+
{
248+
cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "topology/cpu-capacity",
249+
cpu_capacity_sysctl_add, cpu_capacity_sysctl_remove);
236250

237251
return 0;
238252
}

drivers/base/auxiliary.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ static void auxiliary_bus_shutdown(struct device *dev)
244244
auxdrv->shutdown(auxdev);
245245
}
246246

247-
static struct bus_type auxiliary_bus_type = {
247+
static const struct bus_type auxiliary_bus_type = {
248248
.name = "auxiliary",
249249
.probe = auxiliary_bus_probe,
250250
.remove = auxiliary_bus_remove,

drivers/base/bus.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ static void device_insertion_sort_klist(struct device *a, struct list_head *list
10301030
list_move_tail(&a->p->knode_bus.n_node, list);
10311031
}
10321032

1033-
void bus_sort_breadthfirst(struct bus_type *bus,
1033+
void bus_sort_breadthfirst(const struct bus_type *bus,
10341034
int (*compare)(const struct device *a,
10351035
const struct device *b))
10361036
{
@@ -1194,7 +1194,7 @@ static void system_root_device_release(struct device *dev)
11941194
kfree(dev);
11951195
}
11961196

1197-
static int subsys_register(struct bus_type *subsys,
1197+
static int subsys_register(const struct bus_type *subsys,
11981198
const struct attribute_group **groups,
11991199
struct kobject *parent_of_root)
12001200
{
@@ -1264,7 +1264,7 @@ static int subsys_register(struct bus_type *subsys,
12641264
* directory itself and not some create fake root-device placed in
12651265
* /sys/devices/system/<name>.
12661266
*/
1267-
int subsys_system_register(struct bus_type *subsys,
1267+
int subsys_system_register(const struct bus_type *subsys,
12681268
const struct attribute_group **groups)
12691269
{
12701270
return subsys_register(subsys, groups, &system_kset->kobj);
@@ -1282,7 +1282,7 @@ EXPORT_SYMBOL_GPL(subsys_system_register);
12821282
* There's no restriction on device naming. This is for kernel software
12831283
* constructs which need sysfs interface.
12841284
*/
1285-
int subsys_virtual_register(struct bus_type *subsys,
1285+
int subsys_virtual_register(const struct bus_type *subsys,
12861286
const struct attribute_group **groups)
12871287
{
12881288
struct kobject *virtual_dir;

drivers/base/class.c

+1
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ int class_register(const struct class *cls)
213213
return 0;
214214

215215
err_out:
216+
lockdep_unregister_key(key);
216217
kfree(cp);
217218
return error;
218219
}

0 commit comments

Comments
 (0)