[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y+uFqYRZELDquAJ7@hirez.programming.kicks-ass.net>
Date: Tue, 14 Feb 2023 13:59:21 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Kai Huang <kai.huang@...el.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
linux-mm@...ck.org, dave.hansen@...el.com, tglx@...utronix.de,
seanjc@...gle.com, pbonzini@...hat.com, dan.j.williams@...el.com,
rafael.j.wysocki@...el.com, kirill.shutemov@...ux.intel.com,
ying.huang@...el.com, reinette.chatre@...el.com,
len.brown@...el.com, tony.luck@...el.com, ak@...ux.intel.com,
isaku.yamahata@...el.com, chao.gao@...el.com,
sathyanarayanan.kuppuswamy@...ux.intel.com, david@...hat.com,
bagasdotme@...il.com, sagis@...gle.com, imammedo@...hat.com
Subject: Re: [PATCH v9 07/18] x86/virt/tdx: Do TDX module per-cpu
initialization
On Tue, Feb 14, 2023 at 12:59:14AM +1300, Kai Huang wrote:
> +/*
> + * Call @func on all online cpus one by one but skip those cpus
> + * when @skip_func is valid and returns true for them.
> + */
> +static int tdx_on_each_cpu_cond(int (*func)(void *), void *func_data,
> + bool (*skip_func)(int cpu, void *),
> + void *skip_data)
> +{
> + int cpu;
> +
> + for_each_online_cpu(cpu) {
> + int ret;
> +
> + if (skip_func && skip_func(cpu, skip_data))
> + continue;
> +
> + /*
> + * SEAMCALL can be time consuming. Call the @func on
> + * remote cpu via smp_call_on_cpu() instead of
> + * smp_call_function_single() to avoid busy waiting.
> + */
> + ret = smp_call_on_cpu(cpu, func, func_data, true);
> + if (ret)
> + return ret;
> + }
> +
> + return 0;
> +}
schedule_on_each_cpu() ?
Powered by blists - more mailing lists