* [PATCH] x86: make DR6_RESERVED/DR_CONTROL_RESERVED unsigned long
@ 2013-11-19 19:21 Oleg Nesterov
2013-11-19 19:22 ` Oleg Nesterov
2013-11-20 12:48 ` Frederic Weisbecker
0 siblings, 2 replies; 3+ messages in thread
From: Oleg Nesterov @ 2013-11-19 19:21 UTC (permalink / raw)
To: H. Peter Anvin, Ingo Molnar; +Cc: Frederic Weisbecker, linux-kernel
DR6_RESERVED and DR_CONTROL_RESERVED are used to clear the unwanted
bits in the "unsigned long" data, but "ulong &= ~int" also clears the
upper bits that are not specified in mask.
This is actually fine, dr6[32:63] are reserved, but this is not clear
so it would be better to make them "unsigned long" to cleanup the code.
However, depending on sizeof(long), DR6_RESERVED should be either
0xFFFF0FF0 or 0xFFFFFFFF_FFFF0FF0, so this patch redefines them as
(~ 32_bit_mask UL) to avoid ifdef's.
Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Suggested-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
arch/x86/include/uapi/asm/debugreg.h | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/arch/x86/include/uapi/asm/debugreg.h b/arch/x86/include/uapi/asm/debugreg.h
index 3c0874d..4ff5d05 100644
--- a/arch/x86/include/uapi/asm/debugreg.h
+++ b/arch/x86/include/uapi/asm/debugreg.h
@@ -15,7 +15,7 @@
are either reserved or not of interest to us. */
/* Define reserved bits in DR6 which are always set to 1 */
-#define DR6_RESERVED (0xFFFF0FF0)
+#define DR6_RESERVED (~0xF00FUL)
#define DR_TRAP0 (0x1) /* db0 */
#define DR_TRAP1 (0x2) /* db1 */
@@ -64,11 +64,7 @@
We can slow the instruction pipeline for instructions coming via the
gdt or the ldt if we want to. I am not sure why this is an advantage */
-#ifdef __i386__
-#define DR_CONTROL_RESERVED (0xFC00) /* Reserved by Intel */
-#else
-#define DR_CONTROL_RESERVED (0xFFFFFFFF0000FC00UL) /* Reserved */
-#endif
+#define DR_CONTROL_RESERVED (~0xFFFF03FFUL) /* Reserved by Intel */
#define DR_LOCAL_SLOWDOWN (0x100) /* Local slow the pipeline */
#define DR_GLOBAL_SLOWDOWN (0x200) /* Global slow the pipeline */
--
1.5.5.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: make DR6_RESERVED/DR_CONTROL_RESERVED unsigned long
2013-11-19 19:21 [PATCH] x86: make DR6_RESERVED/DR_CONTROL_RESERVED unsigned long Oleg Nesterov
@ 2013-11-19 19:22 ` Oleg Nesterov
2013-11-20 12:48 ` Frederic Weisbecker
1 sibling, 0 replies; 3+ messages in thread
From: Oleg Nesterov @ 2013-11-19 19:22 UTC (permalink / raw)
To: H. Peter Anvin, Ingo Molnar; +Cc: Frederic Weisbecker, linux-kernel
On 11/19, Oleg Nesterov wrote:
>
> DR6_RESERVED and DR_CONTROL_RESERVED are used to clear the unwanted
> bits in the "unsigned long" data, but "ulong &= ~int" also clears the
> upper bits that are not specified in mask.
>
> This is actually fine, dr6[32:63] are reserved, but this is not clear
> so it would be better to make them "unsigned long" to cleanup the code.
>
> However, depending on sizeof(long), DR6_RESERVED should be either
> 0xFFFF0FF0 or 0xFFFFFFFF_FFFF0FF0, so this patch redefines them as
> (~ 32_bit_mask UL) to avoid ifdef's.
Peter, iirc you acked this patch, but its seems it was lost.
Oleg.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] x86: make DR6_RESERVED/DR_CONTROL_RESERVED unsigned long
2013-11-19 19:21 [PATCH] x86: make DR6_RESERVED/DR_CONTROL_RESERVED unsigned long Oleg Nesterov
2013-11-19 19:22 ` Oleg Nesterov
@ 2013-11-20 12:48 ` Frederic Weisbecker
1 sibling, 0 replies; 3+ messages in thread
From: Frederic Weisbecker @ 2013-11-20 12:48 UTC (permalink / raw)
To: Oleg Nesterov; +Cc: H. Peter Anvin, Ingo Molnar, linux-kernel
On Tue, Nov 19, 2013 at 08:21:45PM +0100, Oleg Nesterov wrote:
> DR6_RESERVED and DR_CONTROL_RESERVED are used to clear the unwanted
> bits in the "unsigned long" data, but "ulong &= ~int" also clears the
> upper bits that are not specified in mask.
>
> This is actually fine, dr6[32:63] are reserved, but this is not clear
> so it would be better to make them "unsigned long" to cleanup the code.
>
> However, depending on sizeof(long), DR6_RESERVED should be either
> 0xFFFF0FF0 or 0xFFFFFFFF_FFFF0FF0, so this patch redefines them as
> (~ 32_bit_mask UL) to avoid ifdef's.
>
> Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
> Suggested-by: H. Peter Anvin <hpa@zytor.com>
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Ok, I'm queuing it just to make sure it's not forgotten.
Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-11-20 12:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-19 19:21 [PATCH] x86: make DR6_RESERVED/DR_CONTROL_RESERVED unsigned long Oleg Nesterov
2013-11-19 19:22 ` Oleg Nesterov
2013-11-20 12:48 ` Frederic Weisbecker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox