Skip to contentSkip to conversation

make hdrscheck.sh force __asm__ in exported headers

PATCH In review Mike Frysinger 4 participants 9 messages Jun 17, 2007 – Jun 18, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 make hdrscheck.sh force __asm__ in exported headers

This updates scripts/hdrschecks.sh by grepping for asm() constructs and rejecting them in favor of __asm__() in exported headers.

---

scripts/hdrcheck.sh +11 -0
index 3159858..33d17cc 100755
@@ -6,5 +6,16 @@ for FILE in `grep '^[ \t]*#[ \t]*include[ \t]*<' $2 | cut -f2 -d\< | cut -f1 -d\
 	exit 1
     fi
 done
+
+# make sure we export __asm__(), not asm()
+lines=$(grep -n -E \
+	-e '\<asm[[:space:]]*(_{1,2}?volatile_{1,2}?[[:space:]]*)?\(' \
+	$2)
+if [ -n "$lines" ] ; then
+	echo "$2 should convert asm() usage to __asm__() in exported headers"
+	echo "$lines"
+	exit 1
+fi
+
 # FIXME: List dependencies into $3
 touch $3
#1 lore raw
Quoted 2 lines · On Sun, 17 Jun 2007 18:54:24 -0400 Mike Frysinger <[email protected]> wrote:

This updates scripts/hdrschecks.sh by grepping for asm() constructs and rejecting them in favor of __asm__() in exported headers.

And does the kernel pass these checks? Which architectures have been tested?

#2 lore raw
Quoted 5 lines · Andrew Morton
Quoted 2 lines · On Sun, 17 Jun 2007 18:54:24 -0400 Mike Frysinger <[email protected]> wrote:

This updates scripts/hdrschecks.sh by grepping for asm() constructs and rejecting them in favor of __asm__() in exported headers.

And does the kernel pass these checks?

nope ... should i audit the arches before this gets merged ?

Quoted 1 line

Which architectures have been tested?

i386 passes, blackfin/x86_64 fail a simple asm/unistd.h, and x86_64 fails a bunch in asm/msr.h, but last time i tried to patch that, the maintainer said they were going to be hiding a bunch of that stuff anyways
-mike

#3 lore raw
Quoted 8 lines · On Mon, 18 Jun 2007 01:17:46 -0400 Mike Frysinger <[email protected]> wrote:
Quoted 5 lines · Andrew Morton
Quoted 2 lines · On Sun, 17 Jun 2007 18:54:24 -0400 Mike Frysinger <[email protected]> wrote:

This updates scripts/hdrschecks.sh by grepping for asm() constructs and rejecting them in favor of __asm__() in exported headers.

And does the kernel pass these checks?

nope ... should i audit the arches before this gets merged ?

Yes please. I'd rather not break things in this fashion: it causes a storm of emails which I need to redirect to the appropriate maintainers who then take an arbitrarily long time to do anything. Meanwhile lots of testers get impacted and this reduces the testing level of all the other thousands of patches in there.

Quoted 5 lines
Quoted 1 line

Which architectures have been tested?

i386 passes, blackfin/x86_64 fail a simple asm/unistd.h, and x86_64 fails a bunch in asm/msr.h, but last time i tried to patch that, the maintainer said they were going to be hiding a bunch of that stuff anyways

Well I would prefer that we merge as many fixes as poss into -mm before merging this patch - to reduce the impact on testers.

If these fixes are "wrong" but work then that's fine. I just keep spamming the maintainer with the wrong-but-works patch until he wakes up and fixes it for real.

Also, your changelog sucks:

This updates scripts/hdrschecks.sh by grepping for asm() constructs and rejecting them in favor of __asm__() in exported headers.

well OK. But for what reason? We can see a lot of pain in this patch but no gain. The changelog should tell us what the benefit is, so we can make informed tradeoff decisions.

#4 lore raw
Quoted 8 lines · Andrew Morton
Quoted 7 lines · On Mon, 18 Jun 2007 01:17:46 -0400 Mike Frysinger <[email protected]> wrote:
Quoted 5 lines · Andrew Morton
Quoted 2 lines · On 17 Jun 2007 18:54:24 -0400 Mike Frysinger <[email protected]> wrote:

This updates scripts/hdrschecks.sh by grepping for asm() constructs and rejecting them in favor of __asm__() in exported headers.

And does the kernel pass these checks?

Quoted 7 lines
Quoted 1 line

nope ... should i audit the arches before this gets merged ?

Yes please. I'd rather not break things in this fashion: it causes a storm of emails which I need to redirect to the appropriate maintainers who then take an arbitrarily long time to do anything. Meanwhile lots of testers get impacted and this reduces the testing level of all the other thousands of patches in there.

makes sense, i'll post some stuff

Quoted 8 lines

Also, your changelog sucks:

This updates scripts/hdrschecks.sh by grepping for asm() constructs and rejecting them in favor of __asm__() in exported headers.

well OK. But for what reason? We can see a lot of pain in this patch but no gain. The changelog should tell us what the benefit is, so we can make informed tradeoff decisions.

sorry, i blame GNU changelog style ;)
-mike

#5 lore raw
In reply to Andrew Morton
Quoted 8 lines · Andrew Morton

Also, your changelog sucks:

This updates scripts/hdrschecks.sh by grepping for asm() constructs and rejecting them in favor of __asm__() in exported headers.

well OK. But for what reason? We can see a lot of pain in this patch but no gain. The changelog should tell us what the benefit is, so we can make informed tradeoff decisions.

err, should have included the rationale in previous e-mail ...

we want to audit asm/volatile because both constructs will fail in userland builds when GNU extensions are turned off (like -std=c99) ... __asm__ and __volatile__ will work in both places.
-mike

#6 lore raw
In reply to Andrew Morton
Quoted 11 lines · Andrew Morton
Quoted 4 lines · On Mon, 18 Jun 2007 01:17:46 -0400 Mike Frysinger <[email protected]> wrote:
Quoted 1 line · Andrew Morton

And does the kernel pass these checks?

nope ... should i audit the arches before this gets merged ?

Yes please. I'd rather not break things in this fashion: it causes a storm of emails which I need to redirect to the appropriate maintainers who then take an arbitrarily long time to do anything. Meanwhile lots of testers get impacted and this reduces the testing level of all the other thousands of patches in there.

with the few patches i just sent out, the following pass:
alpha arm avr32 blackfin i386 ia64 m68k mips powerpc s390 sh sparc x86_64

cris and parisc fail vanilla git regardless
-mike

#7 lore raw
In reply to Mike Frysinger
Quoted 2 lines · Mike Frysinger

This updates scripts/hdrschecks.sh by grepping for asm() constructs and rejecting them in favor of __asm__() in exported headers.

Hi Mike.

I have a new version of hdrcheck in works written in perl
and a bit faster too.
I hope to finish it off this weekend and sent it for review. Could I ask you to pick it up and add the below test to that version when it hits mainline - assuming that the other patches has hit mainline too. I do not want this check before we are clean so we basically use it to check that noone introduce a bug.

And next time please put some effort in the _why_ part more than the _how_ part of the changelog.

Sam

#8 lore raw
Quoted 11 lines · Sam Ravnborg
Quoted 2 lines · Mike Frysinger

This updates scripts/hdrschecks.sh by grepping for asm() constructs and rejecting them in favor of __asm__() in exported headers.

I have a new version of hdrcheck in works written in perl
and a bit faster too.
I hope to finish it off this weekend and sent it for review. Could I ask you to pick it up and add the below test to that version when it hits mainline - assuming that the other patches has hit mainline too. I do not want this check before we are clean so we basically use it to check that noone introduce a bug.

that's fine ... one of the other things i wanted to add were checks to make sure the exported headers did not contain [us](8|16|32|64) references, but there's headers which refer to these in comment blocks or use them as members of structs (like the netfilter code) so i couldnt add that check without passing things through the preprocessor ... perhaps your perl code would better accommodate this, perhaps not ;)
-mike