[Cbe-oss-dev] [PATCH 07/11 v3]MARS: Remove api argument params structs
Kazunori Asayama
asayama at sm.sony.co.jp
Tue Sep 16 16:45:06 EST 2008
Yuji Mano wrote:
> This removes the mars_params and mars_task_params structure previously passed
> into the mars context and mars task APIs.
>
> Parameter arguments are now passed in directly.
>
> Signed-off-by: Yuji Mano <yuji.mano at am.sony.com>
>
> ---
> v3:
> - revert v2 change and keep num_mpus_max() function but cache the result of
> spe_cpu_info_get (so we can use the cached spe count later if needed)
> v2:
> - replace num_mpus_max() with mpu_check() that avoids calling spe_cpu_info_get
> multiple times
>
> include/host/mars/mars_context.h | 23 +++---------------
> include/host/mars/mars_task.h | 32 +++++++------------------
> src/host/lib/mars_context.c | 49 +++++++++++++++++----------------------
> src/host/lib/mars_task.c | 34 +++++++++++----------------
> 4 files changed, 50 insertions(+), 88 deletions(-)
(snip)
> --- a/src/host/lib/mars_context.c
> +++ b/src/host/lib/mars_context.c
> @@ -48,9 +48,17 @@
>
> extern struct spe_program_handle mars_kernel_entry;
>
> -static int num_mpus_max(void)
> +static uint32_t num_mpus_max(void)
> {
> - return spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
> + static int count = -1;
> +
> + if (count < 0) {
> + count = spe_cpu_info_get(SPE_COUNT_PHYSICAL_SPES, -1);
> + if (count < 0)
> + count = 0;
> + }
> +
> + return count;
> }
This doesn't seem to be thread-safe?
--
(ASAYAMA Kazunori
(asayama at sm.sony.co.jp))
t
More information about the cbe-oss-dev
mailing list