[dpdk-dev] mempool/octeontx: fix natural alignment being optimized out

Message ID 20180118134433.20997-1-pbhagavatula@caviumnetworks.com (mailing list archive)
State Accepted, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Pavan Nikhilesh Jan. 18, 2018, 1:44 p.m. UTC
  The mbox messages are naturally aligned and in some cases compiler
optimization might disregard natural alignment.
Use volatile key word to force compiler to disable optimizing and
maintain alignment.

Fixes: aecb8e093b52 ("event/octeontx: introduce specialized mbox message copy")
Cc: stable@dpdk.org

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
---
 drivers/mempool/octeontx/octeontx_mbox.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Santosh Shukla Jan. 18, 2018, 4:54 p.m. UTC | #1
On Thursday 18 January 2018 07:14 PM, Pavan Nikhilesh wrote:
> The mbox messages are naturally aligned and in some cases compiler
> optimization might disregard natural alignment.
> Use volatile key word to force compiler to disable optimizing and
> maintain alignment.
>
> Fixes: aecb8e093b52 ("event/octeontx: introduce specialized mbox message copy")
> Cc: stable@dpdk.org
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> ---

Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
  
Thomas Monjalon Jan. 18, 2018, 11:33 p.m. UTC | #2
18/01/2018 17:54, santosh:
> On Thursday 18 January 2018 07:14 PM, Pavan Nikhilesh wrote:
> > The mbox messages are naturally aligned and in some cases compiler
> > optimization might disregard natural alignment.
> > Use volatile key word to force compiler to disable optimizing and
> > maintain alignment.
> >
> > Fixes: aecb8e093b52 ("event/octeontx: introduce specialized mbox message copy")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> 
> Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>

Applied, thanks
  

Patch

diff --git a/drivers/mempool/octeontx/octeontx_mbox.c b/drivers/mempool/octeontx/octeontx_mbox.c
index 640a58d3d..c89f4f513 100644
--- a/drivers/mempool/octeontx/octeontx_mbox.c
+++ b/drivers/mempool/octeontx/octeontx_mbox.c
@@ -61,7 +61,7 @@  struct mbox_ram_hdr {
 };
 
 static inline void
-mbox_msgcpy(uint8_t *d, const uint8_t *s, uint16_t size)
+mbox_msgcpy(volatile uint8_t *d, volatile const uint8_t *s, uint16_t size)
 {
 	uint16_t i;