This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] MIPS: Fix PR target/39079, __builtin___clear_cache() broken on SMP ISA_HAS_SYNCI systems.
- From: David Daney <ddaney at caviumnetworks dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>, rdsandiford at googlemail dot com
- Date: Tue, 30 Jun 2009 11:49:55 -0700
- Subject: Re: [PATCH] MIPS: Fix PR target/39079, __builtin___clear_cache() broken on SMP ISA_HAS_SYNCI systems.
- References: <4A49447A.firstname.lastname@example.org> <email@example.com>
Richard Sandiford wrote:
David Daney <firstname.lastname@example.org> writes:
From the bug:
We expand __builtin___clear_cache() to a 'synci' instruction on
ISA_HAS_SYNCI systems, which invalidates the icache only on the
On an SMP system, the caches on all CPUs should be invalidated. To
achieve this we need to drop back to the old way of doing things by
using the cache flush system call.
To fix this, I added a new command line option (-msynci/-mno-synci) that
enables and disables the generation of the synci instruction for
clearing the icache. The default is to disable synci, but the default
can be overridden at configure time with the --with-synci option.
Thanks for doing this. My only real concern is that having an -msynci
option and using it in this way might be confusing. Most other -m
instruction options control whether the ISA supports an instruction,
whereas here we care about whether an available instruction can be
used in a certain way.
What do you think about having an -mmp/-mup pair of options instead?
If the idea's OK, suggestions for better names are welcome.
There are a several issues.
-msynci controls whether or not we emit synci instructions. -mmp says
something about the memory architecture of the target, although exactly
what is not well defined.
We could arbitrarily say that with -mmp that synci is not safe. But
what about the 'sync' that is emitted at the start of all the atomic
memory insns and the memory_barrier insn? Would it be safe to remove
them under -mup?
Another issue is interlinking -mmp and -mup code. Should there be
tagging of the objects and linker support to merge the tags?
In retrospect it seems like a mistake to have added
__builtin___clear_cache(). Perhaps we should just revert it and have
the only option be multiprocessor safe code.
I don't really have a preference, but something should be done.