[gem5-dev] Change in public/gem5[master]: mem: Signal the local monitor when clearing the global monitor

2017-10-13 Thread Nikos Nikoleris (Gerrit)
Nikos Nikoleris has submitted this change and it was merged. (  
https://gem5-review.googlesource.com/3760 )


Change subject: mem: Signal the local monitor when clearing the global  
monitor

..

mem: Signal the local monitor when clearing the global monitor

ARM systems require the coordination of the global and local
monitors. When the system is run without caches the global monitor is
implemented in the abstract memory object. This change adds a callback
from the abstract memory that notifies the local monitor when the
global monitor is cleared.

Additionally, for ARM systems the local monitor signals the event
register and wakes the thread context up. Subsequent wait-for-event
(WFE) instructions will be immediately signaled.

Change-Id: If6c038f3a6bea7239ba4258f07f39c7f9a30500b
Reviewed-by: Andreas Sandberg 
Reviewed-on: https://gem5-review.googlesource.com/3760
Maintainer: Nikos Nikoleris 
Reviewed-by: Jason Lowe-Power 
---
M src/arch/alpha/locked_mem.hh
M src/arch/arm/locked_mem.hh
A src/arch/generic/locked_mem.hh
M src/arch/mips/locked_mem.hh
A src/arch/null/locked_mem.hh
M src/arch/power/locked_mem.hh
M src/arch/riscv/locked_mem.hh
M src/arch/sparc/locked_mem.hh
M src/arch/x86/locked_mem.hh
M src/mem/abstract_mem.cc
10 files changed, 196 insertions(+), 104 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved
  Nikos Nikoleris: Looks good to me, approved



diff --git a/src/arch/alpha/locked_mem.hh b/src/arch/alpha/locked_mem.hh
index 7998cbd..ba577e8 100644
--- a/src/arch/alpha/locked_mem.hh
+++ b/src/arch/alpha/locked_mem.hh
@@ -135,6 +135,13 @@
 return true;
 }

+template 
+inline void
+globalClearExclusive(XC *xc)
+{
+xc->getCpuPtr()->wakeup(xc->threadId());
+}
+
 } // namespace AlphaISA

 #endif // __ARCH_ALPHA_LOCKED_MEM_HH__
diff --git a/src/arch/arm/locked_mem.hh b/src/arch/arm/locked_mem.hh
index 8aa1812..2fcbc4a 100644
--- a/src/arch/arm/locked_mem.hh
+++ b/src/arch/arm/locked_mem.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013 ARM Limited
+ * Copyright (c) 2012-2013,2017 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
@@ -148,6 +148,20 @@
 return true;
 }

+template 
+inline void
+globalClearExclusive(XC *xc)
+{
+// A spinlock would typically include a Wait For Event (WFE) to
+// conserve energy. The ARMv8 architecture specifies that an event
+// is automatically generated when clearing the exclusive monitor
+// to wake up the processor in WFE.
+DPRINTF(LLSC,"Clearing lock and signaling sev\n");
+xc->setMiscReg(MISCREG_LOCKFLAG, false);
+// Implement ARMv8 WFE/SEV semantics
+xc->setMiscReg(MISCREG_SEV_MAILBOX, true);
+xc->getCpuPtr()->wakeup(xc->threadId());
+}

 } // namespace ArmISA

diff --git a/src/arch/generic/locked_mem.hh b/src/arch/generic/locked_mem.hh
new file mode 100644
index 000..68a4ff5
--- /dev/null
+++ b/src/arch/generic/locked_mem.hh
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2017 ARM Limited
+ * All rights reserved
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder.  You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
+ * Copyright (c) 2006 The Regents of The University of Michigan
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR 

[gem5-dev] Change in public/gem5[master]: mem: Signal the local monitor when clearing the global monitor

2017-08-08 Thread Curtis Dunham (Gerrit)
Curtis Dunham has uploaded a new patch set (#2) to the change originally  
created by Nikos Nikoleris. ( https://gem5-review.googlesource.com/3760 )


Change subject: mem: Signal the local monitor when clearing the global  
monitor

..

mem: Signal the local monitor when clearing the global monitor

ARM systems require the coordination of the global and local
monitors. When the system is run without caches the global monitor is
implemented in the abstract memory object. This change adds a callback
from the abstract memory that notifies the local monitor when the
global monitor is cleared.

Additionally, for ARM systems the local monitor signals the event
register and wakes the thread context up. Subsequent wait-for-event
(WFE) instructions will be immediately signaled.

Change-Id: If6c038f3a6bea7239ba4258f07f39c7f9a30500b
Reviewed-by: Andreas Sandberg 
---
M src/arch/alpha/locked_mem.hh
M src/arch/arm/locked_mem.hh
A src/arch/generic/locked_mem.hh
M src/arch/mips/locked_mem.hh
A src/arch/null/locked_mem.hh
M src/arch/power/locked_mem.hh
M src/arch/riscv/locked_mem.hh
M src/arch/sparc/locked_mem.hh
M src/arch/x86/locked_mem.hh
M src/mem/abstract_mem.cc
10 files changed, 196 insertions(+), 104 deletions(-)


--
To view, visit https://gem5-review.googlesource.com/3760
To unsubscribe, or for help writing mail filters, visit  
https://gem5-review.googlesource.com/settings


Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If6c038f3a6bea7239ba4258f07f39c7f9a30500b
Gerrit-Change-Number: 3760
Gerrit-PatchSet: 2
Gerrit-Owner: Nikos Nikoleris 
Gerrit-Reviewer: Andreas Sandberg 
Gerrit-Reviewer: Jason Lowe-Power 
___
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

[gem5-dev] Change in public/gem5[master]: mem: Signal the local monitor when clearing the global monitor

2017-06-14 Thread Nikos Nikoleris (Gerrit)

Hello Andreas Sandberg,

I'd like you to do a code review. Please visit

https://gem5-review.googlesource.com/3760

to review the following change.


Change subject: mem: Signal the local monitor when clearing the global  
monitor

..

mem: Signal the local monitor when clearing the global monitor

ARM systems require the coordination of the global and local
monitors. When the system is run without caches the global monitor is
implemented in the abstract memory object. This change adds a callback
from the abstract memory that notifies the local monitor when the
global monitor is cleared.

Additionally, for ARM systems the local monitor signals the event
register and wakes the thread context up. Subsequent wait-for-event
(WFE) instructions will be immediately signaled.

Change-Id: If6c038f3a6bea7239ba4258f07f39c7f9a30500b
Reviewed-by: Andreas Sandberg 
---
M src/arch/alpha/locked_mem.hh
M src/arch/arm/locked_mem.hh
A src/arch/generic/locked_mem.hh
M src/arch/mips/locked_mem.hh
A src/arch/null/locked_mem.hh
M src/arch/power/locked_mem.hh
M src/arch/riscv/locked_mem.hh
M src/arch/sparc/locked_mem.hh
M src/arch/x86/locked_mem.hh
M src/mem/abstract_mem.cc
10 files changed, 188 insertions(+), 103 deletions(-)



diff --git a/src/arch/alpha/locked_mem.hh b/src/arch/alpha/locked_mem.hh
index 7998cbd..ba577e8 100644
--- a/src/arch/alpha/locked_mem.hh
+++ b/src/arch/alpha/locked_mem.hh
@@ -135,6 +135,13 @@
 return true;
 }

+template 
+inline void
+globalClearExclusive(XC *xc)
+{
+xc->getCpuPtr()->wakeup(xc->threadId());
+}
+
 } // namespace AlphaISA

 #endif // __ARCH_ALPHA_LOCKED_MEM_HH__
diff --git a/src/arch/arm/locked_mem.hh b/src/arch/arm/locked_mem.hh
index 8aa1812..2fcbc4a 100644
--- a/src/arch/arm/locked_mem.hh
+++ b/src/arch/arm/locked_mem.hh
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2013 ARM Limited
+ * Copyright (c) 2012-2013,2017 ARM Limited
  * All rights reserved
  *
  * The license below extends only to copyright in the software and shall
@@ -148,6 +148,20 @@
 return true;
 }

+template 
+inline void
+globalClearExclusive(XC *xc)
+{
+// A spinlock would typically include a Wait For Event (WFE) to
+// conserve energy. The ARMv8 architecture specifies that an event
+// is automatically generated when clearing the exclusive monitor
+// to wake up the processor in WFE.
+DPRINTF(LLSC,"Clearing lock and signaling sev\n");
+xc->setMiscReg(MISCREG_LOCKFLAG, false);
+// Implement ARMv8 WFE/SEV semantics
+xc->setMiscReg(MISCREG_SEV_MAILBOX, true);
+xc->getCpuPtr()->wakeup(xc->threadId());
+}

 } // namespace ArmISA

diff --git a/src/arch/generic/locked_mem.hh b/src/arch/generic/locked_mem.hh
new file mode 100644
index 000..68a4ff5
--- /dev/null
+++ b/src/arch/generic/locked_mem.hh
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2017 ARM Limited
+ * All rights reserved
+ *
+ * The license below extends only to copyright in the software and shall
+ * not be construed as granting a license to any other intellectual
+ * property including but not limited to intellectual property relating
+ * to a hardware implementation of the functionality of the software
+ * licensed hereunder.  You may use the software subject to the license
+ * terms below provided that you ensure that this notice is replicated
+ * unmodified and in its entirety in all distributions of the software,
+ * modified or unmodified, in source code or in binary form.
+ *
+ * Copyright (c) 2006 The Regents of The University of Michigan
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARI