All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Chancellor <natechancellor@gmail.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: dan.j.williams@intel.com, vkoul@kernel.org,
	appana.durga.rao@xilinx.com, dmaengine@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: dmaengine: xilinx_dma: Fix __aligned attribute on zynqmp_dma_desc_ll
Date: Tue, 11 Sep 2018 16:48:20 -0700	[thread overview]
Message-ID: <20180911234820.GA12913@flashbox> (raw)

On Tue, Sep 11, 2018 at 04:37:48PM -0700, Nick Desaulniers wrote:
> On Tue, Sep 11, 2018 at 4:06 PM Nathan Chancellor
> <natechancellor@gmail.com> wrote:
> >
> > Clang warns:
> >
> > drivers/dma/xilinx/zynqmp_dma.c:166:4: warning: attribute 'aligned' is
> > ignored, place it after "struct" to apply attribute to type declaration
> > [-Wignored-attributes]
> > }; __aligned(64)
> >    ^
> > ./include/linux/compiler_types.h:200:38: note: expanded from macro
> > '__aligned'
> > #define __aligned(x)            __attribute__((aligned(x)))
> >                                                ^
> > 1 warning generated.
> >
> > Place __aligned before the semicolon.
> >
> > Fixes: b0cc417c1637 ("dmaengine: Add Xilinx zynqmp dma engine driver support")
> > Reported-by: Nick Desaulniers <ndesaulniers@google.com>
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> >  drivers/dma/xilinx/zynqmp_dma.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
> > index c74a88b65039..dc19d67cb8c1 100644
> > --- a/drivers/dma/xilinx/zynqmp_dma.c
> > +++ b/drivers/dma/xilinx/zynqmp_dma.c
> > @@ -163,7 +163,7 @@ struct zynqmp_dma_desc_ll {
> >         u32 ctrl;
> >         u64 nxtdscraddr;
> >         u64 rsvd;
> > -}; __aligned(64)
> > +} __aligned(64);
> 
> Thanks for this patch Nathan.  Thinking more about this...the integer
> passed to __attribute__((aligned(x))) should be in terms of bytes.  64
> bytes seems kind of high.  Maybe they meant 64 *bits* thus 8 *bytes*
> which already the default alignment of the struct:
> https://godbolt.org/z/7vW6E3
> 
> In which case, the correct fix is to remove the `__aligned(64);`
> outright.  Since that doesn't change anything (thanks to clang's
> helpful -Wignored-attributes), such a patch would be "No Functional
> Change" (does not change the status quo).  Still, it might be good for
> the maintainer to remark if 64 *byte* alignment was intentional (I
> would think not, but I don't have the datasheet for this piece of
> hardware in front of me; never say never) before sending such a patch.
> 
> If the 64 *byte* (512 bit) alignment was intentional (again, which I
> doubt), then this patch is good to go, but that would then be a
> functional change and should be tested by someone with hardware.
> 

Thanks for the review Nick. If that is indeed the case, I will spin up a v2.

> 
> >
> >  /**
> >   * struct zynqmp_dma_desc_sw - Per Transaction structure
> > --
> > 2.18.0
> >
> 
> 
> -- 
> Thanks,
> ~Nick Desaulniers

WARNING: multiple messages have this Message-ID (diff)
From: Nathan Chancellor <natechancellor@gmail.com>
To: Nick Desaulniers <ndesaulniers@google.com>
Cc: dan.j.williams@intel.com, vkoul@kernel.org,
	appana.durga.rao@xilinx.com, dmaengine@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] dmaengine: xilinx_dma: Fix __aligned attribute on zynqmp_dma_desc_ll
Date: Tue, 11 Sep 2018 16:48:20 -0700	[thread overview]
Message-ID: <20180911234820.GA12913@flashbox> (raw)
In-Reply-To: <CAKwvOd=KaX4+3J4WGOcWBAfhHEyytXKKCLHFdCuDAr5McQ-g=g@mail.gmail.com>

On Tue, Sep 11, 2018 at 04:37:48PM -0700, Nick Desaulniers wrote:
> On Tue, Sep 11, 2018 at 4:06 PM Nathan Chancellor
> <natechancellor@gmail.com> wrote:
> >
> > Clang warns:
> >
> > drivers/dma/xilinx/zynqmp_dma.c:166:4: warning: attribute 'aligned' is
> > ignored, place it after "struct" to apply attribute to type declaration
> > [-Wignored-attributes]
> > }; __aligned(64)
> >    ^
> > ./include/linux/compiler_types.h:200:38: note: expanded from macro
> > '__aligned'
> > #define __aligned(x)            __attribute__((aligned(x)))
> >                                                ^
> > 1 warning generated.
> >
> > Place __aligned before the semicolon.
> >
> > Fixes: b0cc417c1637 ("dmaengine: Add Xilinx zynqmp dma engine driver support")
> > Reported-by: Nick Desaulniers <ndesaulniers@google.com>
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> >  drivers/dma/xilinx/zynqmp_dma.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
> > index c74a88b65039..dc19d67cb8c1 100644
> > --- a/drivers/dma/xilinx/zynqmp_dma.c
> > +++ b/drivers/dma/xilinx/zynqmp_dma.c
> > @@ -163,7 +163,7 @@ struct zynqmp_dma_desc_ll {
> >         u32 ctrl;
> >         u64 nxtdscraddr;
> >         u64 rsvd;
> > -}; __aligned(64)
> > +} __aligned(64);
> 
> Thanks for this patch Nathan.  Thinking more about this...the integer
> passed to __attribute__((aligned(x))) should be in terms of bytes.  64
> bytes seems kind of high.  Maybe they meant 64 *bits* thus 8 *bytes*
> which already the default alignment of the struct:
> https://godbolt.org/z/7vW6E3
> 
> In which case, the correct fix is to remove the `__aligned(64);`
> outright.  Since that doesn't change anything (thanks to clang's
> helpful -Wignored-attributes), such a patch would be "No Functional
> Change" (does not change the status quo).  Still, it might be good for
> the maintainer to remark if 64 *byte* alignment was intentional (I
> would think not, but I don't have the datasheet for this piece of
> hardware in front of me; never say never) before sending such a patch.
> 
> If the 64 *byte* (512 bit) alignment was intentional (again, which I
> doubt), then this patch is good to go, but that would then be a
> functional change and should be tested by someone with hardware.
> 

Thanks for the review Nick. If that is indeed the case, I will spin up a v2.

> 
> >
> >  /**
> >   * struct zynqmp_dma_desc_sw - Per Transaction structure
> > --
> > 2.18.0
> >
> 
> 
> -- 
> Thanks,
> ~Nick Desaulniers

             reply	other threads:[~2018-09-11 23:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-11 23:48 Nathan Chancellor [this message]
2018-09-11 23:48 ` [PATCH] dmaengine: xilinx_dma: Fix __aligned attribute on zynqmp_dma_desc_ll Nathan Chancellor
  -- strict thread matches above, loose matches on Subject: below --
2018-09-11 23:37 Nick Desaulniers
2018-09-11 23:37 ` [PATCH] " Nick Desaulniers
2018-09-11 23:05 Nathan Chancellor
2018-09-11 23:05 ` [PATCH] " Nathan Chancellor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180911234820.GA12913@flashbox \
    --to=natechancellor@gmail.com \
    --cc=appana.durga.rao@xilinx.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.