Skip to contentSkip to conversation

exec.c: Clarify comment about tlb_flush() flush_global parameter

PATCH Applied Peter Maydell 3 participants 4 messages Jan 17, 2012 – Feb 1, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 exec.c: Clarify comment about tlb_flush() flush_global parameter

Clarify the comment about tlb_flush()'s flush_global parameter, so it is clearer what it does and why it is OK that the implementation currently ignores it.

---
Minor clarification following a conversation on IRC...

 exec.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
exec.c +12 -2
index 7f9f730..f667cf0 100644
@@ -1876,8 +1876,18 @@ static CPUTLBEntry s_cputlb_empty_entry = {
     .addend     = -1,
 };
 
-/* NOTE: if flush_global is true, also flush global entries (not
-   implemented yet) */
+/* NOTE:
+ * If flush_global is true (the usual case), flush all tlb entries.
+ * If flush_global is false, flush (at least) all tlb entries not
+ * marked global.
+ *
+ * Since QEMU doesn't currently implement a global/not-global flag
+ * for tlb entries, at the moment tlb_flush() will also flush all
+ * tlb entries in the flush_global == false case. This is OK because
+ * CPU architectures generally permit an implementation to drop
+ * entries from the TLB at any time, so flushing more entries than
+ * required is only an efficiency issue, not a correctness issue.
+ */
 void tlb_flush(CPUState *env, int flush_global)
 {
     int i;
Signature · 1 line
1.7.1
#1 lore raw

Ping?

-- PMM

Quoted 40 lines · Peter Maydell

Clarify the comment about tlb_flush()'s flush_global parameter, so it is clearer what it does and why it is OK that the implementation currently ignores it.

---
Minor clarification following a conversation on IRC...

 exec.c |   14 ++++++++++++--

 1 files changed, 12 insertions(+), 2 deletions(-)
exec.c +12 -3
index 7f9f730..f667cf0 100644
@@ -1876,8 +1876,18 @@ static CPUTLBEntry s_cputlb_empty_entry = {
     .addend     = -1,
  };
 
-/* NOTE: if flush_global is true, also flush global entries (not
-   implemented yet) */
+/* NOTE:
+ * If flush_global is true (the usual case), flush all tlb entries.
+ * If flush_global is false, flush (at least) all tlb entries not
+ * marked global.
+ *
+ * Since QEMU doesn't currently implement a global/not-global flag
+ * for tlb entries, at the moment tlb_flush() will also flush all
+ * tlb entries in the flush_global == false case. This is OK because
+ * CPU architectures generally permit an implementation to drop
+ * entries from the TLB at any time, so flushing more entries than
+ * required is only an efficiency issue, not a correctness issue.
+ */
  void tlb_flush(CPUState *env, int flush_global)
  {
     int i;
--

1.7.1

Reviewed-by on v1 1/1
#2 lore raw
In reply to Peter Maydell

Am 17.01.2012 14:23, schrieb Peter Maydell:

Quoted 5 lines

Clarify the comment about tlb_flush()'s flush_global parameter, so it is clearer what it does and why it is OK that the implementation currently ignores it.

CC'ing qemu-trivial.

Andreas

Quoted 31 lines

---
Minor clarification following a conversation on IRC...

 exec.c |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)
exec.c +12 -2
index 7f9f730..f667cf0 100644
@@ -1876,8 +1876,18 @@ static CPUTLBEntry s_cputlb_empty_entry = {
     .addend     = -1,
 };
 
-/* NOTE: if flush_global is true, also flush global entries (not
-   implemented yet) */
+/* NOTE:
+ * If flush_global is true (the usual case), flush all tlb entries.
+ * If flush_global is false, flush (at least) all tlb entries not
+ * marked global.
+ *
+ * Since QEMU doesn't currently implement a global/not-global flag
+ * for tlb entries, at the moment tlb_flush() will also flush all
+ * tlb entries in the flush_global == false case. This is OK because
+ * CPU architectures generally permit an implementation to drop
+ * entries from the TLB at any time, so flushing more entries than
+ * required is only an efficiency issue, not a correctness issue.
+ */
 void tlb_flush(CPUState *env, int flush_global)
 {
     int i;
Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#3 lore raw
In reply to Peter Maydell
Quoted 5 lines · Peter Maydell

Clarify the comment about tlb_flush()'s flush_global parameter, so it is clearer what it does and why it is OK that the implementation currently ignores it.

Applied. Thanks.

Regards,

Anthony Liguori

Quoted 31 lines

---
Minor clarification following a conversation on IRC...

  exec.c |   14 ++++++++++++--
  1 files changed, 12 insertions(+), 2 deletions(-)
exec.c +12 -2
index 7f9f730..f667cf0 100644
@@ -1876,8 +1876,18 @@ static CPUTLBEntry s_cputlb_empty_entry = {
      .addend     = -1,
  };
 
-/* NOTE: if flush_global is true, also flush global entries (not
-   implemented yet) */
+/* NOTE:
+ * If flush_global is true (the usual case), flush all tlb entries.
+ * If flush_global is false, flush (at least) all tlb entries not
+ * marked global.
+ *
+ * Since QEMU doesn't currently implement a global/not-global flag
+ * for tlb entries, at the moment tlb_flush() will also flush all
+ * tlb entries in the flush_global == false case. This is OK because
+ * CPU architectures generally permit an implementation to drop
+ * entries from the TLB at any time, so flushing more entries than
+ * required is only an efficiency issue, not a correctness issue.
+ */
  void tlb_flush(CPUState *env, int flush_global)
  {
      int i;