All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@maxwell.research.nokia.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Hans Verkuil <hverkuil@xs4all.nl>, linux-media@vger.kernel.org
Subject: Re: [RFC/PATCH v4 07/11] media: Entities, pads and links enumeration
Date: Thu, 16 Sep 2010 18:36:29 +0300	[thread overview]
Message-ID: <4C92397D.9040707@maxwell.research.nokia.com> (raw)
In-Reply-To: <201009161120.27327.laurent.pinchart@ideasonboard.com>

Hi Laurent and Hans,

Laurent Pinchart wrote:
> Hi Hans,
> 
> On Monday 06 September 2010 18:51:59 Hans Verkuil wrote:
>> On Wednesday, September 01, 2010 16:05:10 Laurent Pinchart wrote:
>>> On Saturday 28 August 2010 13:02:22 Hans Verkuil wrote:
>>>> On Friday, August 20, 2010 17:29:09 Laurent Pinchart wrote:

...

>>>>> +};
>>>>
>>>> Should this be a packed struct?
>>>
>>> Why ? :-) Packed struct are most useful when they need to match hardware
>>> structures or network protocols. Packing a structure can generate
>>> unaligned fields, which are bad performance-wise.
>>
>> I'm thinking about preventing a compat32 mess as we have for v4l.
>>
>> It is my understanding that the only way to prevent different struct sizes
>> between 32 and 64 bit is to use packed.
> 
> I don't think that's correct. Different struct sizes between 32bit and 64bit 
> are caused by variable-size fields, such as 'long' (32bit on 32bit 
> architectures, 64bit on 64bit architectures). I might be wrong though.

As far as I understand that's another reason for the structures not
being exactly the same. Alignment of different data types in structures
depends on ABI. I don't know the exact rules for all the architectures
Linux supports if there are cases where the alignment would be different
for 32-bit and 64-bit and smaller than the data type. On ARM there have
been different alignments depending on ABI (EABI vs. GNU ABI) which is
now practically history though.

I couldn't find a better reference than this:

<URL:http://developers.sun.com/solaris/articles/about_amd64_abi.html>

64-bit integers are aligned differently on 32-bit and 64-bit x86 but the
alignment is still smaller or equal to the size of the data type.

I'd also pack them to be sure. The structures should be constructed so
that the alignment is sane even if they are packed. In that case there's
no harm done by packing. It just prevents a failure (32-bit vs. 64-bit)
if there's a problem with the definition.

Just my 2 cents worth. :)

Regards,

-- 
Sakari Ailus
sakari.ailus@maxwell.research.nokia.com

  reply	other threads:[~2010-09-16 15:41 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-20 15:29 [RFC/PATCH v4 00/11] Media controller (core and V4L2) Laurent Pinchart
2010-08-20 15:29 ` [RFC/PATCH v4 01/11] media: Media device node support Laurent Pinchart
2010-08-20 15:29 ` [RFC/PATCH v4 02/11] media: Media device Laurent Pinchart
2010-08-28 10:26   ` Hans Verkuil
2010-09-01 13:51     ` Laurent Pinchart
2010-08-20 15:29 ` [RFC/PATCH v4 03/11] media: Entities, pads and links Laurent Pinchart
2010-08-28 10:31   ` Hans Verkuil
2010-09-01 13:51     ` Laurent Pinchart
2010-09-09  0:41   ` Mauro Carvalho Chehab
2010-09-14 13:51     ` Laurent Pinchart
2010-08-20 15:29 ` [RFC/PATCH v4 04/11] media: Entity graph traversal Laurent Pinchart
2010-09-09  0:46   ` Mauro Carvalho Chehab
2010-09-14 13:59     ` Laurent Pinchart
2010-08-20 15:29 ` [RFC/PATCH v4 05/11] media: Reference count and power handling Laurent Pinchart
2010-09-09  0:58   ` Mauro Carvalho Chehab
2010-09-11 20:38     ` Sakari Ailus
2010-09-16  8:46       ` Laurent Pinchart
2010-09-16 10:35         ` Mauro Carvalho Chehab
2010-09-16 11:11           ` Laurent Pinchart
2010-08-20 15:29 ` [RFC/PATCH v4 06/11] media: Media device information query Laurent Pinchart
2010-08-28 10:44   ` Hans Verkuil
2010-09-01 13:58     ` Laurent Pinchart
2010-08-20 15:29 ` [RFC/PATCH v4 07/11] media: Entities, pads and links enumeration Laurent Pinchart
2010-08-28 11:02   ` Hans Verkuil
2010-09-01 14:05     ` Laurent Pinchart
2010-09-06 16:51       ` Hans Verkuil
2010-09-16  9:20         ` Laurent Pinchart
2010-09-16 15:36           ` Sakari Ailus [this message]
2010-09-16 23:05             ` Laurent Pinchart
2010-08-20 15:29 ` [RFC/PATCH v4 08/11] media: Links setup Laurent Pinchart
2010-08-28 11:14   ` Hans Verkuil
2010-09-01 14:08     ` Laurent Pinchart
2010-09-06 17:09       ` Hans Verkuil
2010-09-16  9:02         ` Laurent Pinchart
2010-09-09  1:14   ` Mauro Carvalho Chehab
2010-09-16  9:04     ` Laurent Pinchart
2010-08-20 15:29 ` [RFC/PATCH v4 09/11] v4l: Add a media_device pointer to the v4l2_device structure Laurent Pinchart
2010-08-20 15:29 ` [RFC/PATCH v4 10/11] v4l: Make video_device inherit from media_entity Laurent Pinchart
2010-08-20 15:29 ` [RFC/PATCH v4 11/11] v4l: Make v4l2_subdev " Laurent Pinchart
2010-09-09  1:25   ` Mauro Carvalho Chehab
2010-09-16  8:55     ` Laurent Pinchart
2010-09-09  1:44 ` [RFC/PATCH v4 00/11] Media controller (core and V4L2) Mauro Carvalho Chehab
2010-09-14 12:25   ` Laurent Pinchart
2010-09-14 13:24     ` Hans Verkuil
2010-09-14 13:49       ` Laurent Pinchart
2010-09-14 13:34     ` Mauro Carvalho Chehab
2010-09-14 13:48       ` Laurent Pinchart

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=4C92397D.9040707@maxwell.research.nokia.com \
    --to=sakari.ailus@maxwell.research.nokia.com \
    --cc=hverkuil@xs4all.nl \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.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.