From: David Laight <David.Laight@ACULAB.COM>
To: 'Xu Yilun' <yilun.xu@intel.com>
Cc: 'Moritz Fischer' <mdf@kernel.org>,
"linux-fpga@vger.kernel.org" <linux-fpga@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"trix@redhat.com" <trix@redhat.com>,
"lgoncalv@redhat.com" <lgoncalv@redhat.com>
Subject: RE: [PATCH v4 1/4] fpga: dfl: change data type of feature id to u16
Date: Thu, 13 Aug 2020 09:20:43 +0000 [thread overview]
Message-ID: <20ab5d871b154423a4dcefef1ddd64e2@AcuMS.aculab.com> (raw)
In-Reply-To: <20200813090409.GA1080@yilunxu-OptiPlex-7050>
From: Xu Yilun <yilun.xu@intel.com>
> Sent: 13 August 2020 10:04
>
> On Thu, Aug 13, 2020 at 08:28:05AM +0000, David Laight wrote:
> > From: Xu Yilun
> > > Sent: 13 August 2020 08:59
> > > On Wed, Aug 12, 2020 at 08:52:39AM +0000, David Laight wrote:
> > > > From: Moritz Fischer
> > > > > Sent: 12 August 2020 04:56
> > > > >
> > > > > On Mon, Aug 10, 2020 at 10:41:10AM +0800, Xu Yilun wrote:
> > > > > > The feature id is stored in a 12 bit field in DFH. So a u16 variable is
> > > > > > enough for feature id.
> > > > > >
> > > > > > This patch changes all feature id related places to fit u16.
> > > >
> > > > How much bigger does it make the kernel?
> > >
> > > The patch changes the definition of feature id from u64 to u16, and will
> > > make the kernel slightly smaller.
> >
> > Unlikely.
> > Most of the structures will gain a 'pad' field.
> > Using u16 for function parameters and results almost certainly
> > requires instructions to mask the value.
> > Any arithmetic on u16 will require masking instructions on
> > (probably) all architectures except x86.
> >
> > Using 'unsigned int' is probably best.
> >
> > u16 is never a good idea unless you are defining enough
> > of them in a structure (eg as an array) to reduce the
> > structure size below some threshold.
> > (Or are matching some hardware layout.)
>
> I got it. Thanks for your detailed explanation. I think we may change them to
> u32. Is it the same case for u8? Think we may also change the dfl_device_id.type.
Loosely 'yes' but it isn't worth the churn of 'random' changes.
And they aren't often passed to/from functions - which I'm 98% sure
requires masking.
I commented because the compiler was going to add pad fields after
your u16 values - so you'd get do space saving and probably more code.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2020-08-13 9:20 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-10 2:41 [PATCH v4 0/4] Modularization of DFL private feature drivers Xu Yilun
2020-08-10 2:41 ` [PATCH v4 1/4] fpga: dfl: change data type of feature id to u16 Xu Yilun
2020-08-12 3:56 ` Moritz Fischer
2020-08-12 8:52 ` David Laight
2020-08-13 7:58 ` Xu Yilun
2020-08-13 8:28 ` David Laight
2020-08-13 9:04 ` Xu Yilun
2020-08-13 9:20 ` David Laight [this message]
2020-08-20 4:14 ` Moritz Fischer
2020-08-28 5:56 ` Xu Yilun
2020-08-10 2:41 ` [PATCH v4 2/4] fpga: dfl: map feature mmio resources in their own feature drivers Xu Yilun
2020-08-10 5:56 ` Wu, Hao
2020-08-10 15:01 ` Xu Yilun
2020-08-10 2:41 ` [PATCH v4 3/4] fpga: dfl: create a dfl bus type to support DFL devices Xu Yilun
2020-08-10 6:36 ` Wu, Hao
2020-08-10 15:16 ` Xu Yilun
2020-08-10 2:41 ` [PATCH v4 4/4] fpga: dfl: add support for N3000 Nios private feature Xu Yilun
2020-08-10 7:00 ` Wu, Hao
2020-08-10 16:15 ` Xu Yilun
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=20ab5d871b154423a4dcefef1ddd64e2@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=lgoncalv@redhat.com \
--cc=linux-fpga@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mdf@kernel.org \
--cc=trix@redhat.com \
--cc=yilun.xu@intel.com \
/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