* [PATCH] KVM: x86: remove ignored type attribute
@ 2017-06-23 4:41 Nick Desaulniers
2017-06-27 14:31 ` Paolo Bonzini
2017-06-28 2:37 ` [PATCH v2] " Nick Desaulniers
0 siblings, 2 replies; 5+ messages in thread
From: Nick Desaulniers @ 2017-06-23 4:41 UTC (permalink / raw)
Cc: Nick Desaulniers, Paolo Bonzini, Radim Krčmář,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, kvm,
linux-kernel
The macro insn_fetch marks the 'type' argument as having a specified
alignment. Type attributes can only be applied to structs, unions, or
enums, but insn_fetch is only ever invoked with integral types, so Clang
produces 19 -Wignored-attributes warnings for this source file.
Signed-off-by: Nick Desaulniers <nick.desaulniers@gmail.com>
---
arch/x86/kvm/emulate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 7611c034bf95..409081977e59 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -900,7 +900,7 @@ static __always_inline int do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt,
if (rc != X86EMUL_CONTINUE) \
goto done; \
ctxt->_eip += sizeof(_type); \
- _x = *(_type __aligned(1) *) ctxt->fetch.ptr; \
+ _x = *(_type *) ctxt->fetch.ptr; \
ctxt->fetch.ptr += sizeof(_type); \
_x; \
})
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] KVM: x86: remove ignored type attribute
2017-06-23 4:41 [PATCH] KVM: x86: remove ignored type attribute Nick Desaulniers
@ 2017-06-27 14:31 ` Paolo Bonzini
2017-06-28 2:37 ` [PATCH v2] " Nick Desaulniers
1 sibling, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2017-06-27 14:31 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Radim Krčmář,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, kvm,
linux-kernel
On 23/06/2017 06:41, Nick Desaulniers wrote:
> The macro insn_fetch marks the 'type' argument as having a specified
> alignment. Type attributes can only be applied to structs, unions, or
> enums, but insn_fetch is only ever invoked with integral types, so Clang
> produces 19 -Wignored-attributes warnings for this source file.
>
> Signed-off-by: Nick Desaulniers <nick.desaulniers@gmail.com>
> ---
> arch/x86/kvm/emulate.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index 7611c034bf95..409081977e59 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -900,7 +900,7 @@ static __always_inline int do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt,
> if (rc != X86EMUL_CONTINUE) \
> goto done; \
> ctxt->_eip += sizeof(_type); \
> - _x = *(_type __aligned(1) *) ctxt->fetch.ptr; \
> + _x = *(_type *) ctxt->fetch.ptr; \
> ctxt->fetch.ptr += sizeof(_type); \
> _x; \
> })
>
Can you make a patch that uses memcpy instead? Both GCC and clang will
compile it to a simple load.
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] KVM: x86: remove ignored type attribute
2017-06-23 4:41 [PATCH] KVM: x86: remove ignored type attribute Nick Desaulniers
2017-06-27 14:31 ` Paolo Bonzini
@ 2017-06-28 2:37 ` Nick Desaulniers
2017-06-28 2:44 ` Nick Desaulniers
2017-06-30 10:46 ` Paolo Bonzini
1 sibling, 2 replies; 5+ messages in thread
From: Nick Desaulniers @ 2017-06-28 2:37 UTC (permalink / raw)
Cc: Nick Desaulniers, Paolo Bonzini, Radim Krčmář,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, kvm,
linux-kernel
The macro insn_fetch marks the 'type' argument as having a specified
alignment. Type attributes can only be applied to structs, unions, or
enums, but insn_fetch is only ever invoked with integral types, so Clang
produces 19 -Wignored-attributes warnings for this source file.
Signed-off-by: Nick Desaulniers <nick.desaulniers@gmail.com>
---
Changes in v2:
* prefer memcpy
* fix up trailing tabs
arch/x86/kvm/emulate.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 7611c034bf95..f9c0359f3fdd 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -900,7 +900,7 @@ static __always_inline int do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt,
if (rc != X86EMUL_CONTINUE) \
goto done; \
ctxt->_eip += sizeof(_type); \
- _x = *(_type __aligned(1) *) ctxt->fetch.ptr; \
+ memcpy(&_x, ctxt->fetch.ptr, sizeof(_type)); \
ctxt->fetch.ptr += sizeof(_type); \
_x; \
})
--
2.11.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] KVM: x86: remove ignored type attribute
2017-06-28 2:37 ` [PATCH v2] " Nick Desaulniers
@ 2017-06-28 2:44 ` Nick Desaulniers
2017-06-30 10:46 ` Paolo Bonzini
1 sibling, 0 replies; 5+ messages in thread
From: Nick Desaulniers @ 2017-06-28 2:44 UTC (permalink / raw)
To: Paolo Bonzini, Radim Krčmář,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, kvm,
linux-kernel
gah, forgot to amend the trailing tab change in.
Do you mind just fixing it up when you merge or shall I send v3?
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] KVM: x86: remove ignored type attribute
2017-06-28 2:37 ` [PATCH v2] " Nick Desaulniers
2017-06-28 2:44 ` Nick Desaulniers
@ 2017-06-30 10:46 ` Paolo Bonzini
1 sibling, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2017-06-30 10:46 UTC (permalink / raw)
To: Nick Desaulniers
Cc: Radim Krčmář,
Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86, kvm,
linux-kernel
On 28/06/2017 04:37, Nick Desaulniers wrote:
> The macro insn_fetch marks the 'type' argument as having a specified
> alignment. Type attributes can only be applied to structs, unions, or
> enums, but insn_fetch is only ever invoked with integral types, so Clang
> produces 19 -Wignored-attributes warnings for this source file.
>
> Signed-off-by: Nick Desaulniers <nick.desaulniers@gmail.com>
> ---
> Changes in v2:
> * prefer memcpy
> * fix up trailing tabs
>
> arch/x86/kvm/emulate.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
> index 7611c034bf95..f9c0359f3fdd 100644
> --- a/arch/x86/kvm/emulate.c
> +++ b/arch/x86/kvm/emulate.c
> @@ -900,7 +900,7 @@ static __always_inline int do_insn_fetch_bytes(struct x86_emulate_ctxt *ctxt,
> if (rc != X86EMUL_CONTINUE) \
> goto done; \
> ctxt->_eip += sizeof(_type); \
> - _x = *(_type __aligned(1) *) ctxt->fetch.ptr; \
> + memcpy(&_x, ctxt->fetch.ptr, sizeof(_type)); \
> ctxt->fetch.ptr += sizeof(_type); \
> _x; \
> })
>
Fixed up the tab and pushed, thanks.
Paolo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-06-30 10:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-23 4:41 [PATCH] KVM: x86: remove ignored type attribute Nick Desaulniers
2017-06-27 14:31 ` Paolo Bonzini
2017-06-28 2:37 ` [PATCH v2] " Nick Desaulniers
2017-06-28 2:44 ` Nick Desaulniers
2017-06-30 10:46 ` Paolo Bonzini
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.