public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* I have a problem about changing a bundle, help!
@ 2007-12-21  5:58 Lai Jiangshan
  0 siblings, 0 replies; 2+ messages in thread
From: Lai Jiangshan @ 2007-12-21  5:58 UTC (permalink / raw)
  To: linux-ia64

Hello!
	
	Are the following statements safe? Is there any coherence problem?
And why?

	/* change the instruction */
	memcpy(ins_addr, ins_buf, sizeof(struct ia64_bundle));
 	flush_icache_range(ins_addr, ins_addr + sizeof(struct ia64_bundle));

	I have make sure that just one thread changes the instruction(bundle),
but maybe a lot of threads execute the instruction in the same time.

	Is any thread executes an error instruction(maybe an error bundle
combined with old bundle and new bundle, or other) in some condition?

	If the statements are unsafe, how can i change a bundle safely?

Best Regards!
Lai Jiangshan

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: I have a problem about changing a bundle, help!
@ 2008-01-02 22:03 Luck, Tony
  0 siblings, 0 replies; 2+ messages in thread
From: Luck, Tony @ 2008-01-02 22:03 UTC (permalink / raw)
  To: linux-ia64

>	If the statements are unsafe, how can i change a bundle safely?

If you are on a cpu that supports "st16" (Montecito or later) then you can
use that to update the whole bundle in a single atomic write rather than
using memcpy().

Without st16, I think the only safe way to update the bundle is to ensure
that no processor is executing it while the update is occuring.

-Tony

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-01-02 22:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-21  5:58 I have a problem about changing a bundle, help! Lai Jiangshan
  -- strict thread matches above, loose matches on Subject: below --
2008-01-02 22:03 Luck, Tony

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox