From: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
To: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Greg KH <greg@kroah.com>,
linux-next@vger.kernel.org, Jason Baron <jbaron@redhat.com>,
Greg Banks <gnb@sgi.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Linux Kernel Development <linux-kernel@vger.kernel.org>,
Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: Re: linux-next: driver-core tree build failure
Date: Tue, 10 Mar 2009 14:31:17 +0100 (CET) [thread overview]
Message-ID: <alpine.LRH.2.00.0903101423200.25436@vixen.sonytel.be> (raw)
In-Reply-To: <20090310192440.949884a1.sfr@canb.auug.org.au>
On Tue, 10 Mar 2009, Stephen Rothwell wrote:
> Today's linux-next build (x86_64 allmodconfig) failed like this:
>
> crypto/zlib.c: In function 'zlib_compress_update':
> crypto/zlib.c:148: warning: initialization makes integer from pointer without a cast
> crypto/zlib.c:148: error: initializer element is not computable at load time
> crypto/zlib.c:148: error: (near initialization for 'descriptor.primary_hash')
> crypto/zlib.c:148: warning: excess elements in struct initializer
> crypto/zlib.c:148: warning: (near initialization for 'descriptor')
>
> And many more similar. This line is a pr_debug() statement, so the
> finger points at commit 25b67b75587d43ff3f09ad88c03c70a38372d95d
> ("dynamic debug: combine dprintk and dynamic printk") from the
> driver-core tree.
>
> The preprocessed code looks like this:
>
> static int zlib_compress_update(struct crypto_pcomp *tfm,
> struct comp_request *req)
> {
> int ret;
> struct zlib_ctx *dctx = crypto_tfm_ctx(crypto_pcomp_tfm(tfm));
> struct z_stream_s *stream = &dctx->comp_stream;
>
> do { do { static struct _ddebug descriptor __attribute__((__used__)) __attribute__((section("__verbose"), aligned(8))) = { "zlib", __func__, "/scratch/sfr/next/crypto/zlib.c", "%s: " "avail_in %u, avail_out %u\n", __func__, 55, 33, 148, 0 }; if (({ int __ret = 0; if (__builtin_expect(!!((dynamic_debug_enabled & (1LL << 55)) && (dynamic_debug_enabled2 & (1LL << 33))), 0)) if (__builtin_expect(!!(descriptor.flags), 0)) __ret = 1; __ret; })) printk("<7>" "zlib" ":" "%s: " "avail_in %u, avail_out %u\n", __func__, req->avail_in, req->avail_out); } while (0); } while (0);
>
> The problem is the line:
>
> #define pr_fmt(fmt) "%s: " fmt, __func__
>
> in crypto/zlib.c which was introduced by commit
> bf68e65ec9ea61e32ab71bef59aa5d24d255241f ("crypto: zlib - New zlib crypto
> module, using pcomp") from the crypto tree.
>
> For today, I have removed the above line from crypto/zlib.c, but
> something better needs to be done for tomorrow!
I had a closer look. It happens on all archs, if CONFIG_DYNAMIC_DEBUG=y.
crypto/zlib.c has:
#define pr_fmt(fmt) "%s: " fmt, __func__
If CONFIG_DYNAMIC_DEBUG is set, include/linux/kernel.h has:
#define pr_debug(fmt, ...) do { \
dynamic_pr_debug(pr_fmt(fmt), ##__VA_ARGS__); \
} while (0)
include/linux/dynamic_debug.h has:
#define dynamic_pr_debug(fmt, ...) do { \
static struct _ddebug descriptor \
__used \
__attribute__((section("__verbose"), aligned(8))) = \
{ KBUILD_MODNAME, __func__, __FILE__, fmt, DEBUG_HASH, \
DEBUG_HASH2, __LINE__, _DPRINTK_FLAGS_DEFAULT }; \
if (__dynamic_dbg_enabled(descriptor)) \
printk(KERN_DEBUG KBUILD_MODNAME ":" fmt, \
##__VA_ARGS__); \
} while (0)
So in crypto/zlib.c,
| pr_debug("avail_in %u, avail_out %u\n", req->avail_in, req->avail_out);
is expanded to
| do {
| do {
| static struct _ddebug descriptor
| __attribute__((__used__))
| __attribute__((section("__verbose"), aligned(8))) = {
| "zlib",
| __func__,
| "crypto/zlib.c",
| "%s: " "avail_in %u, avail_out %u\n",
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This is the actual format string
| __func__,
^^^^^^^^^
But this is the first parameter, which should not be here!!!
| 55,
| 33,
| 150,
| 0
| };
| if (({
| int __ret = 0;
| if (__builtin_expect(!!((dynamic_debug_enabled & (1LL << 55)) &&
| (dynamic_debug_enabled2 & (1LL << 33))), 0))
| if (__builtin_expect(!!(descriptor.flags), 0))
| __ret = 1;
| __ret;
| }))
| printk("<7>" "zlib" ":" "%s: " "avail_in %u, avail_out %u\n", __func__,
| req->avail_in, req->avail_out);
| } while (0);
| } while (0);
Due the the superfluous `__func__', all field members are shifted by one
position, and compilation breaks.
Apparently inside dynamic_pr_debug(), `fmt' is:
"avail_in %u, avail_out %u\n", __func__
instead of only the part before the comma:
"avail_in %u, avail_out %u\n"
For the non-CONFIG_DYNAMIC_DEBUG case, pr_debug() is expanded correctly:
DEBUG is defined:
#define pr_debug(fmt, ...) \
printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__)
and the line is expanded to:
| printk("<7>" "%s: " "avail_in %u, avail_out %u\n", __func__, req->avail_in, req->avail_out);
DEBUG is not defined:
#define pr_debug(fmt, ...) \
({ if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); 0; })
and the line is expanded to:
| ({ if (0) printk("<7>" "%s: " "avail_in %u, avail_out %u\n", __func__, req->avail_in, req->avail_out); 0; });
Why doesn't it work for dynamic_pr_debug()?
BTW, Martin: Is `#define pr_fmt(fmt) "%s: " fmt, __func__' a valid and
intended usage of your pr_fmt() infrastructure?
Thanks!
With kind regards,
Geert Uytterhoeven
Software Architect
Sony Techsoft Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium
Phone: +32 (0)2 700 8453
Fax: +32 (0)2 700 8622
E-mail: Geert.Uytterhoeven@sonycom.com
Internet: http://www.sony-europe.com/
A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 · RPR Brussels
Fortis · BIC GEBABEBB · IBAN BE41293037680010
next prev parent reply other threads:[~2009-03-10 13:31 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-10 8:24 linux-next: driver-core tree build failure Stephen Rothwell
2009-03-10 13:31 ` Geert Uytterhoeven [this message]
2009-03-10 13:38 ` Herbert Xu
2009-03-10 13:53 ` Martin Schwidefsky
2009-03-10 15:29 ` Geert Uytterhoeven
2009-03-10 16:08 ` Martin Schwidefsky
2009-03-10 20:02 ` Jason Baron
2009-03-11 3:30 ` Greg KH
2009-03-11 8:33 ` Geert Uytterhoeven
2009-03-11 10:07 ` Greg Banks
2009-03-11 10:50 ` Geert Uytterhoeven
2009-03-11 15:12 ` Jason Baron
-- strict thread matches above, loose matches on Subject: below --
2009-07-14 6:33 Stephen Rothwell
2009-07-14 7:31 ` David Brownell
2009-07-16 22:50 ` Greg KH
2009-06-23 6:01 Stephen Rothwell
2009-06-23 15:29 ` Greg KH
2009-06-23 16:28 ` Greg KH
2009-05-12 3:44 Stephen Rothwell
2009-05-12 4:05 ` Greg KH
2009-05-13 0:13 ` Greg KH
2009-05-13 1:39 ` Stephen Rothwell
2009-05-04 6:25 Stephen Rothwell
2009-05-04 13:00 ` Kay Sievers
2009-05-05 4:18 ` Stephen Rothwell
2009-05-05 4:29 ` Greg KH
2009-05-09 11:16 ` Stephen Rothwell
2009-05-09 13:51 ` Greg KH
2009-03-26 7:34 Stephen Rothwell
2009-03-26 23:00 ` Jesse Barnes
2009-03-16 9:47 Stephen Rothwell
2009-03-22 12:22 ` Stephen Rothwell
2009-03-23 4:23 ` David Miller
2009-01-26 0:50 Stephen Rothwell
2009-01-26 1:10 ` Greg KH
2009-01-26 12:19 ` Kay Sievers
2009-01-26 17:40 ` Greg KH
2008-12-22 12:59 Stephen Rothwell
2008-12-22 14:50 ` Mark McLoughlin
2008-12-23 4:29 ` Greg KH
2008-12-29 6:34 ` Stephen Rothwell
2008-12-30 15:28 ` Stephen Rothwell
2009-01-02 7:26 ` Greg KH
2009-01-03 4:32 ` Stephen Rothwell
2008-12-11 0:21 Stephen Rothwell
2008-12-11 4:55 ` Greg KH
2008-11-19 0:30 Stephen Rothwell
2008-11-19 0:40 ` Kay Sievers
2008-11-19 2:22 ` Stephen Rothwell
2008-11-19 2:24 ` Stephen Rothwell
2008-11-19 6:36 ` Greg KH
2008-11-19 5:43 ` Stephen Rothwell
2008-11-19 6:26 ` Greg KH
2008-11-19 6:51 ` Stephen Rothwell
2008-11-19 6:55 ` Greg KH
2008-09-12 3:53 Stephen Rothwell
2008-09-15 18:58 ` Greg KH
2008-08-15 8:25 Stephen Rothwell
2008-08-16 5:31 ` Greg KH
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=alpine.LRH.2.00.0903101423200.25436@vixen.sonytel.be \
--to=geert.uytterhoeven@sonycom.com \
--cc=gnb@sgi.com \
--cc=greg@kroah.com \
--cc=herbert@gondor.apana.org.au \
--cc=jbaron@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-next@vger.kernel.org \
--cc=schwidefsky@de.ibm.com \
--cc=sfr@canb.auug.org.au \
/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;
as well as URLs for NNTP newsgroup(s).