|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v7 46/50] x86/cpufreq: move the CPU mask out of struct drv_cmd
drv_read() and drv_write() take a struct drv_cmd, whose mask field
says which CPUs to run the access on. Only the initiator uses the
mask, to route the call: do_drv_read() and do_drv_write(), which run
on the target CPUs, never read it. It may point at the initiator's
stack (acpi_cpufreq_target()'s online_policy_cpus).
Drop the field and pass the mask to drv_read() and drv_write() as a
parameter, so that the structure handed to the target CPUs holds only
what they use.
No functional change.
Groundwork for per-CPU stack mappings, to come as part of Address
Space Isolation, which take away a CPU's access to other CPUs' stacks:
a subsequent change passes the structure to the target CPUs by value,
and a copy must carry no stack address.
Assisted-by: Claude Code:claude-opus-4-8, Claude Code:claude-opus-5-5
Signed-off-by: George Dunlap <gwd@xxxxxxxxxxxxxx>
---
Changes in v7:
- New in this version.
---
xen/arch/x86/acpi/cpufreq/acpi.c | 28 +++++++++++++---------------
1 file changed, 13 insertions(+), 15 deletions(-)
diff --git a/xen/arch/x86/acpi/cpufreq/acpi.c b/xen/arch/x86/acpi/cpufreq/acpi.c
index de67f1aee2..7f843bab60 100644
--- a/xen/arch/x86/acpi/cpufreq/acpi.c
+++ b/xen/arch/x86/acpi/cpufreq/acpi.c
@@ -90,7 +90,6 @@ typedef union {
struct drv_cmd {
unsigned int type;
- const cpumask_t *mask;
drv_addr_union addr;
u32 val;
};
@@ -137,25 +136,25 @@ static void cf_check do_drv_write(void *drvcmd)
}
}
-static void drv_read(struct drv_cmd *cmd)
+static void drv_read(const cpumask_t *mask, struct drv_cmd *cmd)
{
cmd->val = 0;
- ASSERT(cpumask_weight(cmd->mask) == 1);
+ ASSERT(cpumask_weight(mask) == 1);
/* to reduce IPI for the sake of performance */
- if (likely(cpumask_test_cpu(smp_processor_id(), cmd->mask)))
+ if (likely(cpumask_test_cpu(smp_processor_id(), mask)))
do_drv_read((void *)cmd);
else
- on_selected_cpus(cmd->mask, do_drv_read, cmd, 1);
+ on_selected_cpus(mask, do_drv_read, cmd, 1);
}
-static void drv_write(struct drv_cmd *cmd)
+static void drv_write(const cpumask_t *mask, struct drv_cmd *cmd)
{
- if (cpumask_equal(cmd->mask, cpumask_of(smp_processor_id())))
+ if (cpumask_equal(mask, cpumask_of(smp_processor_id())))
do_drv_write((void *)cmd);
else
- on_selected_cpus(cmd->mask, do_drv_write, cmd, 1);
+ on_selected_cpus(mask, do_drv_write, cmd, 1);
}
static u32 get_cur_val(const cpumask_t *mask)
@@ -193,9 +192,7 @@ static u32 get_cur_val(const cpumask_t *mask)
return 0;
}
- cmd.mask = cpumask_of(cpu);
-
- drv_read(&cmd);
+ drv_read(cpumask_of(cpu), &cmd);
return cmd.val;
}
@@ -256,6 +253,7 @@ static int cf_check acpi_cpufreq_target(
struct processor_performance *perf;
struct cpufreq_freqs freqs;
cpumask_t online_policy_cpus;
+ const cpumask_t *mask;
struct drv_cmd cmd;
unsigned int next_state = 0; /* Index into freq_table */
unsigned int next_perf_state = 0; /* Index into perf table */
@@ -304,16 +302,16 @@ static int cf_check acpi_cpufreq_target(
}
if (policy->shared_type != CPUFREQ_SHARED_TYPE_ANY)
- cmd.mask = &online_policy_cpus;
+ mask = &online_policy_cpus;
else
- cmd.mask = cpumask_of(policy->cpu);
+ mask = cpumask_of(policy->cpu);
freqs.old = perf->states[perf->state].core_frequency * 1000;
freqs.new = data->freq_table[next_state].frequency;
- drv_write(&cmd);
+ drv_write(mask, &cmd);
- if (acpi_pstate_strict && !check_freqs(cmd.mask, freqs.new, data)) {
+ if (acpi_pstate_strict && !check_freqs(mask, freqs.new, data)) {
printk(KERN_WARNING "Fail transfer to new freq %d\n", freqs.new);
return -EAGAIN;
}
--
2.56.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |