[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2/6] xen/tasklet: Switch data parameter from unsigned long to void *.
Most users pass a vcpu pointer, and only stopmachine_action() takes an integer parameter. Switch to using void * to substantially reduce the number of explicit casts. No functional change. Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- CC: Jan Beulich <JBeulich@xxxxxxxx> CC: Wei Liu <wl@xxxxxxx> CC: Roger Pau Monné <roger.pau@xxxxxxxxxx> CC: Stefano Stabellini <sstabellini@xxxxxxxxxx> CC: Julien Grall <julien@xxxxxxx> CC: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx> --- xen/arch/x86/hvm/hvm.c | 6 ++---- xen/arch/x86/hvm/vlapic.c | 8 +++----- xen/arch/x86/mm/shadow/common.c | 4 ++-- xen/common/domain.c | 15 ++++++--------- xen/common/keyhandler.c | 19 +++++++++---------- xen/common/stop_machine.c | 5 +++-- xen/common/tasklet.c | 6 ++---- xen/common/trace.c | 4 ++-- xen/drivers/char/console.c | 4 ++-- xen/drivers/passthrough/amd/iommu_guest.c | 7 +++---- xen/drivers/passthrough/amd/iommu_init.c | 6 +++--- xen/drivers/passthrough/iommu.c | 4 ++-- xen/drivers/passthrough/vtd/iommu.c | 4 ++-- xen/include/asm-x86/shadow.h | 5 ++--- xen/include/xen/tasklet.h | 10 ++++------ 15 files changed, 47 insertions(+), 60 deletions(-) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 47573f71b8..d909fec30d 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -1525,10 +1525,8 @@ int hvm_vcpu_initialise(struct vcpu *v) if ( (rc = hvm_funcs.vcpu_initialise(v)) != 0 ) /* teardown: hvm_funcs.vcpu_destroy */ goto fail3; - softirq_tasklet_init( - &v->arch.hvm.assert_evtchn_irq_tasklet, - (void(*)(unsigned long))hvm_assert_evtchn_irq, - (unsigned long)v); + softirq_tasklet_init(&v->arch.hvm.assert_evtchn_irq_tasklet, + (void (*)(void *))hvm_assert_evtchn_irq, v); v->arch.hvm.inject_event.vector = HVM_EVENT_VECTOR_UNSET; diff --git a/xen/arch/x86/hvm/vlapic.c b/xen/arch/x86/hvm/vlapic.c index 9b8afb72e8..06235f183e 100644 --- a/xen/arch/x86/hvm/vlapic.c +++ b/xen/arch/x86/hvm/vlapic.c @@ -309,9 +309,9 @@ static void vlapic_init_sipi_one(struct vcpu *target, uint32_t icr) vcpu_unpause(target); } -static void vlapic_init_sipi_action(unsigned long _vcpu) +static void vlapic_init_sipi_action(void *data) { - struct vcpu *origin = (struct vcpu *)_vcpu; + struct vcpu *origin = data; uint32_t icr = vcpu_vlapic(origin)->init_sipi.icr; uint32_t dest = vcpu_vlapic(origin)->init_sipi.dest; uint32_t short_hand = icr & APIC_SHORT_MASK; @@ -1637,9 +1637,7 @@ int vlapic_init(struct vcpu *v) spin_lock_init(&vlapic->esr_lock); - tasklet_init(&vlapic->init_sipi.tasklet, - vlapic_init_sipi_action, - (unsigned long)v); + tasklet_init(&vlapic->init_sipi.tasklet, vlapic_init_sipi_action, v); if ( v->vcpu_id == 0 ) register_mmio_handler(v->domain, &vlapic_mmio_ops); diff --git a/xen/arch/x86/mm/shadow/common.c b/xen/arch/x86/mm/shadow/common.c index 314d837602..6212ec2c4a 100644 --- a/xen/arch/x86/mm/shadow/common.c +++ b/xen/arch/x86/mm/shadow/common.c @@ -3471,9 +3471,9 @@ void shadow_audit_tables(struct vcpu *v) #ifdef CONFIG_PV -void pv_l1tf_tasklet(unsigned long data) +void pv_l1tf_tasklet(void *data) { - struct domain *d = (void *)data; + struct domain *d = data; domain_pause(d); paging_lock(d); diff --git a/xen/common/domain.c b/xen/common/domain.c index ccf689fcbe..865a1cb9d7 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -150,7 +150,7 @@ struct vcpu *vcpu_create(struct domain *d, unsigned int vcpu_id) spin_lock_init(&v->virq_lock); - tasklet_init(&v->continue_hypercall_tasklet, NULL, 0); + tasklet_init(&v->continue_hypercall_tasklet, NULL, NULL); grant_table_init_vcpu(v); @@ -1661,9 +1661,9 @@ struct migrate_info { static DEFINE_PER_CPU(struct migrate_info *, continue_info); -static void continue_hypercall_tasklet_handler(unsigned long _info) +static void continue_hypercall_tasklet_handler(void *data) { - struct migrate_info *info = (struct migrate_info *)_info; + struct migrate_info *info = data; struct vcpu *v = info->vcpu; long res = -EINVAL; @@ -1707,12 +1707,9 @@ int continue_hypercall_on_cpu( info->vcpu = curr; info->nest = 0; - tasklet_kill( - &curr->continue_hypercall_tasklet); - tasklet_init( - &curr->continue_hypercall_tasklet, - continue_hypercall_tasklet_handler, - (unsigned long)info); + tasklet_kill(&curr->continue_hypercall_tasklet); + tasklet_init(&curr->continue_hypercall_tasklet, + continue_hypercall_tasklet_handler, info); get_knownalive_domain(curr->domain); vcpu_pause_nosync(curr); diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index dc6396b225..f50490d0f3 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -71,12 +71,12 @@ static struct keyhandler { #undef KEYHANDLER }; -static void keypress_action(unsigned long unused) +static void keypress_action(void *unused) { handle_keypress(keypress_key, NULL); } -static DECLARE_TASKLET(keypress_tasklet, keypress_action, 0); +static DECLARE_TASKLET(keypress_tasklet, keypress_action, NULL); void handle_keypress(unsigned char key, struct cpu_user_regs *regs) { @@ -199,11 +199,11 @@ static void dump_registers(unsigned char key, struct cpu_user_regs *regs) watchdog_enable(); } -static DECLARE_TASKLET(dump_hwdom_tasklet, NULL, 0); +static DECLARE_TASKLET(dump_hwdom_tasklet, NULL, NULL); -static void dump_hwdom_action(unsigned long arg) +static void dump_hwdom_action(void *data) { - struct vcpu *v = (void *)arg; + struct vcpu *v = data; for ( ; ; ) { @@ -212,7 +212,7 @@ static void dump_hwdom_action(unsigned long arg) break; if ( softirq_pending(smp_processor_id()) ) { - dump_hwdom_tasklet.data = (unsigned long)v; + dump_hwdom_tasklet.data = v; tasklet_schedule_on_cpu(&dump_hwdom_tasklet, v->processor); break; } @@ -233,8 +233,7 @@ static void dump_hwdom_registers(unsigned char key) if ( alt_key_handling && softirq_pending(smp_processor_id()) ) { tasklet_kill(&dump_hwdom_tasklet); - tasklet_init(&dump_hwdom_tasklet, dump_hwdom_action, - (unsigned long)v); + tasklet_init(&dump_hwdom_tasklet, dump_hwdom_action, v); tasklet_schedule_on_cpu(&dump_hwdom_tasklet, v->processor); return; } @@ -433,7 +432,7 @@ static void read_clocks(unsigned char key) maxdif_cycles, sumdif_cycles/count, count, dif_cycles); } -static void run_all_nonirq_keyhandlers(unsigned long unused) +static void run_all_nonirq_keyhandlers(void *unused) { /* Fire all the non-IRQ-context diagnostic keyhandlers */ struct keyhandler *h; @@ -455,7 +454,7 @@ static void run_all_nonirq_keyhandlers(unsigned long unused) } static DECLARE_TASKLET(run_all_keyhandlers_tasklet, - run_all_nonirq_keyhandlers, 0); + run_all_nonirq_keyhandlers, NULL); static void run_all_keyhandlers(unsigned char key, struct cpu_user_regs *regs) { diff --git a/xen/common/stop_machine.c b/xen/common/stop_machine.c index 681b40906d..33d9602217 100644 --- a/xen/common/stop_machine.c +++ b/xen/common/stop_machine.c @@ -134,8 +134,9 @@ int stop_machine_run(int (*fn)(void *), void *data, unsigned int cpu) return ret; } -static void stopmachine_action(unsigned long cpu) +static void stopmachine_action(void *data) { + unsigned int cpu = (unsigned long)data; enum stopmachine_state state = STOPMACHINE_START; BUG_ON(cpu != smp_processor_id()); @@ -181,7 +182,7 @@ static int cpu_callback( if ( action == CPU_UP_PREPARE ) tasklet_init(&per_cpu(stopmachine_tasklet, cpu), - stopmachine_action, cpu); + stopmachine_action, hcpu); return NOTIFY_DONE; } diff --git a/xen/common/tasklet.c b/xen/common/tasklet.c index d4fea3151c..ac89511a09 100644 --- a/xen/common/tasklet.c +++ b/xen/common/tasklet.c @@ -199,8 +199,7 @@ static void migrate_tasklets_from_cpu(unsigned int cpu, struct list_head *list) spin_unlock_irqrestore(&tasklet_lock, flags); } -void tasklet_init( - struct tasklet *t, void (*func)(unsigned long), unsigned long data) +void tasklet_init(struct tasklet *t, void (*func)(void *), void *data) { memset(t, 0, sizeof(*t)); INIT_LIST_HEAD(&t->list); @@ -209,8 +208,7 @@ void tasklet_init( t->data = data; } -void softirq_tasklet_init( - struct tasklet *t, void (*func)(unsigned long), unsigned long data) +void softirq_tasklet_init(struct tasklet *t, void (*func)(void *), void *data) { tasklet_init(t, func, data); t->is_softirq = 1; diff --git a/xen/common/trace.c b/xen/common/trace.c index d1ef81407b..ebfc735b31 100644 --- a/xen/common/trace.c +++ b/xen/common/trace.c @@ -662,12 +662,12 @@ static inline void insert_lost_records(struct t_buf *buf) * Notification is performed in qtasklet to avoid deadlocks with contexts * which __trace_var() may be called from (e.g., scheduler critical regions). */ -static void trace_notify_dom0(unsigned long unused) +static void trace_notify_dom0(void *unused) { send_global_virq(VIRQ_TBUF); } static DECLARE_SOFTIRQ_TASKLET(trace_notify_dom0_tasklet, - trace_notify_dom0, 0); + trace_notify_dom0, NULL); /** * __trace_var - Enters a trace tuple into the trace buffer for the current CPU. diff --git a/xen/drivers/char/console.c b/xen/drivers/char/console.c index 844c5de74e..b31d789a5d 100644 --- a/xen/drivers/char/console.c +++ b/xen/drivers/char/console.c @@ -505,12 +505,12 @@ static void serial_rx(char c, struct cpu_user_regs *regs) __serial_rx(c, regs); } -static void notify_dom0_con_ring(unsigned long unused) +static void notify_dom0_con_ring(void *unused) { send_global_virq(VIRQ_CON_RING); } static DECLARE_SOFTIRQ_TASKLET(notify_dom0_con_ring_tasklet, - notify_dom0_con_ring, 0); + notify_dom0_con_ring, NULL); #ifdef CONFIG_X86 static inline void xen_console_write_debug_port(const char *buf, size_t len) diff --git a/xen/drivers/passthrough/amd/iommu_guest.c b/xen/drivers/passthrough/amd/iommu_guest.c index 1f2bcfbe15..4ed6519e6e 100644 --- a/xen/drivers/passthrough/amd/iommu_guest.c +++ b/xen/drivers/passthrough/amd/iommu_guest.c @@ -435,11 +435,11 @@ static int do_invalidate_dte(struct domain *d, cmd_entry_t *cmd) return 0; } -static void guest_iommu_process_command(unsigned long _d) +static void guest_iommu_process_command(void *data) { unsigned long opcode, tail, head, entries_per_page, cmd_mfn; cmd_entry_t *cmd, *cmd_base; - struct domain *d = (struct domain *)_d; + struct domain *d = data; struct guest_iommu *iommu; iommu = domain_iommu(d); @@ -837,8 +837,7 @@ int guest_iommu_init(struct domain* d) iommu->domain = d; hd->arch.g_iommu = iommu; - tasklet_init(&iommu->cmd_buffer_tasklet, - guest_iommu_process_command, (unsigned long)d); + tasklet_init(&iommu->cmd_buffer_tasklet, guest_iommu_process_command, d); spin_lock_init(&iommu->lock); diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c index 9509124158..2f26fed4a3 100644 --- a/xen/drivers/passthrough/amd/iommu_init.c +++ b/xen/drivers/passthrough/amd/iommu_init.c @@ -33,8 +33,8 @@ static int __initdata nr_amd_iommus; static bool __initdata pci_init; -static void do_amd_iommu_irq(unsigned long data); -static DECLARE_SOFTIRQ_TASKLET(amd_iommu_irq_tasklet, do_amd_iommu_irq, 0); +static void do_amd_iommu_irq(void *data); +static DECLARE_SOFTIRQ_TASKLET(amd_iommu_irq_tasklet, do_amd_iommu_irq, NULL); unsigned int __read_mostly ivrs_bdf_entries; u8 __read_mostly ivhd_type; @@ -723,7 +723,7 @@ static void iommu_check_ppr_log(struct amd_iommu *iommu) spin_unlock_irqrestore(&iommu->lock, flags); } -static void do_amd_iommu_irq(unsigned long data) +static void do_amd_iommu_irq(void *unused) { struct amd_iommu *iommu; diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index 05e740757a..4e19cf56cc 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -369,7 +369,7 @@ int iommu_lookup_page(struct domain *d, dfn_t dfn, mfn_t *mfn, return iommu_call(hd->platform_ops, lookup_page, d, dfn, mfn, flags); } -static void iommu_free_pagetables(unsigned long unused) +static void iommu_free_pagetables(void *unused) { do { struct page_info *pg; @@ -500,7 +500,7 @@ int __init iommu_setup(void) iommu_hwdom_passthrough ? "Passthrough" : iommu_hwdom_strict ? "Strict" : "Relaxed"); printk("Interrupt remapping %sabled\n", iommu_intremap ? "en" : "dis"); - tasklet_init(&iommu_pt_cleanup_tasklet, iommu_free_pagetables, 0); + tasklet_init(&iommu_pt_cleanup_tasklet, iommu_free_pagetables, NULL); } return rc; diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index 664556aa51..c56df8e58e 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -965,7 +965,7 @@ static void __do_iommu_page_fault(struct vtd_iommu *iommu) } } -static void do_iommu_page_fault(unsigned long data) +static void do_iommu_page_fault(void *unused) { struct acpi_drhd_unit *drhd; @@ -2309,7 +2309,7 @@ static int __init vtd_setup(void) } } - softirq_tasklet_init(&vtd_fault_tasklet, do_iommu_page_fault, 0); + softirq_tasklet_init(&vtd_fault_tasklet, do_iommu_page_fault, NULL); if ( !iommu_qinval && iommu_intremap ) { diff --git a/xen/include/asm-x86/shadow.h b/xen/include/asm-x86/shadow.h index 8ebb89c027..907c71f497 100644 --- a/xen/include/asm-x86/shadow.h +++ b/xen/include/asm-x86/shadow.h @@ -230,7 +230,7 @@ static inline bool pv_l1tf_check_l4e(struct domain *d, l4_pgentry_t l4e) return pv_l1tf_check_pte(d, 4, l4e.l4); } -void pv_l1tf_tasklet(unsigned long data); +void pv_l1tf_tasklet(void *data); static inline void pv_l1tf_domain_init(struct domain *d) { @@ -238,8 +238,7 @@ static inline void pv_l1tf_domain_init(struct domain *d) : opt_pv_l1tf_domu; #ifdef CONFIG_SHADOW_PAGING - tasklet_init(&d->arch.paging.shadow.pv_l1tf_tasklet, - pv_l1tf_tasklet, (unsigned long)d); + tasklet_init(&d->arch.paging.shadow.pv_l1tf_tasklet, pv_l1tf_tasklet, d); #endif } diff --git a/xen/include/xen/tasklet.h b/xen/include/xen/tasklet.h index bc9ddace6d..ea73171f6e 100644 --- a/xen/include/xen/tasklet.h +++ b/xen/include/xen/tasklet.h @@ -21,8 +21,8 @@ struct tasklet bool_t is_softirq; bool_t is_running; bool_t is_dead; - void (*func)(unsigned long); - unsigned long data; + void (*func)(void *); + void *data; }; #define _DECLARE_TASKLET(name, func, data, softirq) \ @@ -59,10 +59,8 @@ void tasklet_schedule_on_cpu(struct tasklet *t, unsigned int cpu); void tasklet_schedule(struct tasklet *t); void do_tasklet(void); void tasklet_kill(struct tasklet *t); -void tasklet_init( - struct tasklet *t, void (*func)(unsigned long), unsigned long data); -void softirq_tasklet_init( - struct tasklet *t, void (*func)(unsigned long), unsigned long data); +void tasklet_init(struct tasklet *t, void (*func)(void *), void *data); +void softirq_tasklet_init(struct tasklet *t, void (*func)(void *), void *data); void tasklet_subsys_init(void); #endif /* __XEN_TASKLET_H__ */ -- 2.11.0 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |