Linux IIO development
 help / color / mirror / Atom feed
From: William Breathitt Gray <william.gray@linaro.org>
To: "Nuno Sá" <noname.nuno@gmail.com>
Cc: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	nuno.sa@analog.com, linux-iio@vger.kernel.org,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Jonathan Cameron" <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH] counter: fix privdata alignment
Date: Fri, 9 Feb 2024 04:53:10 -0500	[thread overview]
Message-ID: <ZcX2BohmfzwF1_Is@ishi> (raw)
In-Reply-To: <9abe545667599a085b346bd280fe96201d66f59a.camel@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2109 bytes --]

On Fri, Feb 09, 2024 at 10:07:19AM +0100, Nuno Sá wrote:
> On Fri, 2024-02-09 at 09:30 +0100, Uwe Kleine-König wrote:
> > Hi Nuno,
> > 
> > On Fri, Feb 09, 2024 at 08:42:02AM +0100, Nuno Sá wrote:
> > > On Thu, 2024-02-08 at 13:34 -0500, William Breathitt Gray wrote:
> > > > On Mon, Feb 05, 2024 at 04:58:14PM +0100, Nuno Sa via B4 Relay wrote:
> > > > > diff --git a/drivers/counter/counter-core.c b/drivers/counter/counter-
> > > > > core.c
> > > > > index 09c77afb33ca..073bf6b67a57 100644
> > > > > --- a/drivers/counter/counter-core.c
> > > > > +++ b/drivers/counter/counter-core.c
> > > > > @@ -34,7 +34,7 @@ struct counter_device_allochelper {
> > > > >  	 * This is cache line aligned to ensure private data behaves
> > > > > like if it
> > > > >  	 * were kmalloced separately.
> > > > >  	 */
> > > > > -	unsigned long privdata[] ____cacheline_aligned;
> > > > > +	unsigned long privdata[] __aligned(ARCH_DMA_MINALIGN);
> > > > >  };
> > > > >  
> > > > >  static void counter_device_release(struct device *dev)
> > > > > 
> > > > 
> > > > This change sounds reasonable, but should the comment block above
> > > > privdata be updated to reflect the change?
> > > 
> > > Yeah, maybe. I can spin a new version with that... To be sure, you mean (in
> > > the
> > > comment) private -> privdata, right?
> > 
> > I guess he means: "This is cache line aligned to ensure private data
> > behaves like if it were kmalloced separately." After your change it's
> > not cache line aligned any more. IMHO keeping "private" is fine.
> > 
> > 
> 
> Oh yeah...
> 
> Yeah, it will depend on the platform. In some, it will still be cache aligned
> but in others (as x86 which is DMA coeherent I think), it won't be and we can
> actually safe some memory.
> 
> - Nuno Sá

Yes, I was referring to the possibility that it won't be cache aligned
anymore in some platforms as you mentioned, so a different comment would
be better there now. You can keep the "private" wording if you like, or
use "privdata" if you think it's clearer.

Thanks,

William Breathitt Gray

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

      reply	other threads:[~2024-02-09  9:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-05 15:58 [PATCH] counter: fix privdata alignment Nuno Sa via B4 Relay
2024-02-08 18:34 ` William Breathitt Gray
2024-02-09  7:42   ` Nuno Sá
2024-02-09  8:30     ` Uwe Kleine-König
2024-02-09  9:07       ` Nuno Sá
2024-02-09  9:53         ` William Breathitt Gray [this message]

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=ZcX2BohmfzwF1_Is@ishi \
    --to=william.gray@linaro.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=noname.nuno@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox