public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: Alexander Holler <holler@ahsoftware.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: AMD-IOMMU and problem with __init(data)?
Date: Tue, 29 Sep 2015 17:06:58 +0200	[thread overview]
Message-ID: <20150929150658.GJ3036@8bytes.org> (raw)
In-Reply-To: <5602F7BF.4020009@ahsoftware.de>

As expected it is no bug in the AMD IOMMU driver, but in your code.

On Wed, Sep 23, 2015 at 09:04:31PM +0200, Alexander Holler wrote:
> struct _annotated_initcall {
> 	initcall_t initcall;
> 	unsigned driver_id;
> 	unsigned *dependencies;
> 	struct device_driver *driver;
> };

This struct gets aligned on a 32 bytes boundary.

> +#define ANNOTATED_INITCALLS						\
> +		VMLINUX_SYMBOL(__annotated_initcall_start) = .;		\
> +		*(.annotated_initcall.init)				\
> +		VMLINUX_SYMBOL(__annotated_initcall_end) = .;

But this section does not.

> +	ac = __annotated_initcall_start;
> +	pr_info("ac %p ID %u\n", ac, ac->driver_id);
> +	BUG_ON(ac->driver_id != 23);

So when you access __annotated_initcall_start here, you don't access the
first element of your array, but actually the zero padding before your
struct.

On my system the section was aligned on an 8 bytes boundary, which means
there were 24 bytes of padding before the symbol you try to access.



	Joerg


  parent reply	other threads:[~2015-09-29 15:07 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-23 10:22 AMD-IOMMU and problem with __init(data)? Alexander Holler
2015-09-23 11:43 ` Joerg Roedel
2015-09-23 15:50   ` Alexander Holler
2015-09-23 19:04     ` Alexander Holler
2015-09-26  8:18       ` Alexander Holler
2015-09-29 15:06       ` Joerg Roedel [this message]
2015-09-29 17:17         ` Alexander Holler

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=20150929150658.GJ3036@8bytes.org \
    --to=joro@8bytes.org \
    --cc=holler@ahsoftware.de \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox