On Wed, Feb 27, 2008 at 12:39:32PM +0100, Rob van der Heij wrote:
> On Wed, Feb 27, 2008 at 11:42 AM, Heiko Carstens
> <[EMAIL PROTECTED]> wrote:
>
> > Oh yes, you're absolutely right. Linux issues the ESSA instruction once to
> > figure out if it will work or not (program check or not), just to tell
> > later if the kernel paramater cmma=... makes any sense.
> > So there's no way z/VM could know if Linux is actually using cmma or if it
> > was just a test.
> I have no idea what's possible with an undocumented instruction ;-)
> If nothing else, we can get a CP PTF to only enable it on the 2nd ESSA
> instruction...
Ah no... we can fix that. If you like to patch your kernel the patch below
should fix the incosistency between what z/VM and Linux think about cmma
being active. I just gave it a quick run and it seems to work.
Not guaranteed to work however :)
For the rest I leave it up to Martin to comment, since I its his code.
---
arch/s390/kernel/head64.S | 11 -----------
arch/s390/mm/fault.c | 17 +++++++++++++++--
include/asm-s390/page-states.h | 2 +-
include/asm-s390/setup.h | 1 -
4 files changed, 16 insertions(+), 15 deletions(-)
Index: linux-2.6.16.54-0.2.3/arch/s390/kernel/head64.S
===================================================================
--- linux-2.6.16.54-0.2.3.orig/arch/s390/kernel/head64.S
+++ linux-2.6.16.54-0.2.3/arch/s390/kernel/head64.S
@@ -246,17 +246,6 @@ startup:basr %r13,0
bno 1f-.LPG1(%r13) # if yes, MVCOS is present
oi 6(%r12),2 # set MVCOS flag
1:
-
-#
-# find out if we have the ESSA instruction
-#
- la %r1,0f-.LPG1(%r13) # set program check address
- stg %r1,__LC_PGM_NEW_PSW+8
- lghi %r1,0
- .long 0xb9ab0001 # essa get state
- oi 6(%r12),0x04 # set ESSA flag
-0:
-
lpswe .Lentry-.LPG1(13) # jump to _stext in primary-space,
# virtual and never return ...
.align 16
Index: linux-2.6.16.54-0.2.3/arch/s390/mm/fault.c
===================================================================
--- linux-2.6.16.54-0.2.3.orig/arch/s390/mm/fault.c
+++ linux-2.6.16.54-0.2.3/arch/s390/mm/fault.c
@@ -607,12 +607,25 @@ pfault_interrupt(struct pt_regs *regs, _
#if defined(CONFIG_PAGE_STATES)
-int cmma_flag = 0;
+int cmma_flag;
+
+static inline int machine_has_essa(void)
+{
+ register unsigned long tmp asm("0") = 0;
+ register int rc asm("1") = 0;
+ asm volatile(
+ " .insn rrf,0xb9ab0000,%1,%1,0,0\n"
+ "0: la %0,1\n"
+ "1:\n"
+ EX_TABLE(0b,1b)
+ : "+&d" (rc), "+&d" (tmp));
+ return rc;
+}
static int __init cmma(char *str)
{
if (strcmp(str, "yes") == 0 || strcmp(str, "on") == 0) {
- cmma_flag = MACHINE_HAS_ESSA != 0;
+ cmma_flag = machine_has_essa();
return 1;
}
if (strcmp(str, "no") == 0 || strcmp(str, "off") == 0) {
Index: linux-2.6.16.54-0.2.3/include/asm-s390/setup.h
===================================================================
--- linux-2.6.16.54-0.2.3.orig/include/asm-s390/setup.h
+++ linux-2.6.16.54-0.2.3/include/asm-s390/setup.h
@@ -55,7 +55,6 @@ extern unsigned long machine_flags;
#define MACHINE_HAS_DIAG44 (machine_flags & 32)
#define MACHINE_HAS_IDTE (machine_flags & 128)
#define MACHINE_HAS_DIAG9C (machine_flags & 256)
-#define MACHINE_HAS_ESSA (machine_flags & 1024)
#ifndef __s390x__
#define MACHINE_HAS_IEEE (machine_flags & 2)
Index: linux-2.6.16.54-0.2.3/include/asm-s390/page-states.h
===================================================================
--- linux-2.6.16.54-0.2.3.orig/include/asm-s390/page-states.h
+++ linux-2.6.16.54-0.2.3/include/asm-s390/page-states.h
@@ -84,7 +84,7 @@ static inline int page_set_stable_if_pre
{
int rc;
- if (!MACHINE_HAS_ESSA || PageReserved(page))
+ if (!cmma_flag || PageReserved(page))
return 1;
rc = page_essa(page, ESSA_SET_STABLE_IF_NOT_DISCARDED);
----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390