From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Jimi Xenidis <jimix@pobox.com>
Cc: linuxppc-dev@lists.ozlabs.org, Anton Blanchard <anton@samba.org>
Subject: Re: [PATCH] powerpc: icswx: fix race condition where threads do not get their ACOP register updated in time.
Date: Mon, 27 Feb 2012 10:47:48 +1100 [thread overview]
Message-ID: <1330300068.20389.63.camel@pasglop> (raw)
In-Reply-To: <1329948466-325-1-git-send-email-jimix@pobox.com>
>
> + /*
> + * We could be here because another thread has enabled acop
> + * but the ACOP register has yet to be updated.
> + *
> + * This should have been taken care of by the IPI to sync all
> + * the threads (see smp_call_function(sync_cop, mm, 1)), but
> + * that could take forever if there are a significant amount
> + * of threads.
> + *
> + * Given the number of threads on some of these systems,
> + * perhaps this is the best way to sync ACOP rather than whack
> + * every thread with an IPI.
> + */
This is actually pretty standard stuff... If it was me I would make it
all lazy and avoid the IPI completely but it doesn't necessarily hurt
that much. In any case the "recovery" is indeed needed and you should
probably also remove the pr_debug, it's really just spam.
> + if (acop_copro_type_bit(ct) && current->active_mm->context.acop) {
Shouldn't that be "&" ? In fact, gcc would even warn so either make
it acop_check_copro(acop, ct) or do a (x & y) != 0
Cheers,
Ben.
> + pr_debug("%s[%d]: Spurrious ACOP Fault, CT: %d, bit: 0x%llx "
> + "SPR: 0x%lx, mm->acop: 0x%lx\n",
> + current->comm, current->pid,
> + ct, acop_copro_type_bit(ct), mfspr(SPRN_ACOP),
> + current->active_mm->context.acop);
> +
> + sync_cop(current->active_mm);
> + return 0;
> + }
> +
> + /* check for alternate policy */
> if (!acop_use_cop(ct))
> return 0;
>
> /* at this point the CT is unknown to the system */
> - pr_warn("%s[%d]: Coprocessor %d is unavailable",
> + pr_warn("%s[%d]: Coprocessor %d is unavailable\n",
> current->comm, current->pid, ct);
>
> /* get inst if we don't already have it */
> diff --git a/arch/powerpc/mm/icswx.h b/arch/powerpc/mm/icswx.h
> index 42176bd..6dedc08 100644
> --- a/arch/powerpc/mm/icswx.h
> +++ b/arch/powerpc/mm/icswx.h
> @@ -59,4 +59,10 @@ extern void free_cop_pid(int free_pid);
>
> extern int acop_handle_fault(struct pt_regs *regs, unsigned long address,
> unsigned long error_code);
> +
> +static inline u64 acop_copro_type_bit(unsigned int type)
> +{
> + return 1ULL << (63 - type);
> +}
> +
> #endif /* !_ARCH_POWERPC_MM_ICSWX_H_ */
next prev parent reply other threads:[~2012-02-26 23:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-22 22:07 [PATCH] powerpc: icswx: fix race condition where threads do not get their ACOP register updated in time Jimi Xenidis
2012-02-26 23:47 ` Benjamin Herrenschmidt [this message]
2012-02-27 17:56 ` Jimi Xenidis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1330300068.20389.63.camel@pasglop \
--to=benh@kernel.crashing.org \
--cc=anton@samba.org \
--cc=jimix@pobox.com \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).