public inbox for linux-ia64@vger.kernel.org
 help / color / mirror / Atom feed
* SAL calling conventions + locking
@ 2005-12-09 16:42 Zoltan Menyhart
  2005-12-09 17:03 ` Luck, Tony
  0 siblings, 1 reply; 2+ messages in thread
From: Zoltan Menyhart @ 2005-12-09 16:42 UTC (permalink / raw)
  To: linux-ia64

The SAL specification does say that the SAL procedures should be called
with interrupts enabled if we call them in virtual mode.

Here is the simplified CPEI handler control flow:

ia64_mca_cpe_int_handler():

	/* SAL spec states this should run w/ interrupts enabled */
	local_irq_enable();
	ia64_mca_log_sal_error_record(SAL_INFO_TYPE_CPE):

		ia64_log_get():

			IA64_LOG_LOCK():

				spin_lock_irqsave():

			ia64_sal_get_state_info();
			IA64_LOG_UNLOCK()

		salinfo_log_wakeup()
		if (rh->severity = sal_log_severity_corrected)
			ia64_sal_clear_state_info();

Despite the note "SAL spec ... w/ interrupts enabled" the interrupts
are disabled before "ia64_sal_get_state_info()" is invoked.

Can someone please tell me:
- why the spec. requires to call the SAL with interrupts enabled,
- why Linux calls the SAL with interrupts disabled,
- what happens if the SAL is called with interrupts disabled?

The second issue is:
The lock of the log is released before "salinfo_log_wakeup()" could record
the existence of the current log. Two more logs can arrive and overwrite
the current log without even indicting the loss of the information.
(E.g. CPEI-s with interrupt redirection, CMCI-s on multiple CPUs.)
Should not we keep the log lock at least while "salinfo_log_wakeup()"
executes?

Thanks.

Zoltan Menyhart

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

* RE: SAL calling conventions + locking
  2005-12-09 16:42 SAL calling conventions + locking Zoltan Menyhart
@ 2005-12-09 17:03 ` Luck, Tony
  0 siblings, 0 replies; 2+ messages in thread
From: Luck, Tony @ 2005-12-09 17:03 UTC (permalink / raw)
  To: linux-ia64

>Can someone please tell me:
>- why the spec. requires to call the SAL with interrupts enabled,
>- why Linux calls the SAL with interrupts disabled,
>- what happens if the SAL is called with interrupts disabled?

A quick scan of the SAL spec didn't come up with text to match
that comment.  On the contrary in chapter 8 on calling conventions
table 8-2 on requirements for PSR says that the "i" bit is preserved
across SAL calls (with a footnote "b" remarking that SAL procedures
may not enable interrupts if they are disabled on entry).  This
appears to be very clear that the call can be made either with
interrupts enabled or disabled.

Section 9.1.1 on invoking runtime services in virtual mode does
say that "the normal operating system environment is with translation
on and interrupts enabled but operating system may choose to call SAL
runtime services in physical mode".  This is perhaps a bit hazy, but
I don't see that this should be interpreted as a requirement that
interrupts be enabled when calling in virtual mode.

The SAL_GET_STATE_INFO only says that it is callable in either virtual
or physical mode.

So I think that the comment is wrong, and the SAL spec does not
require that this be called with interrupts enabled.

-Tony

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

end of thread, other threads:[~2005-12-09 17:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-09 16:42 SAL calling conventions + locking Zoltan Menyhart
2005-12-09 17: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