2.6.13-git3-bird1
Subsystems (26)
[email protected]
maintainerPATCH 1/1 2.6.13-git3-bird1
While waaaaay overdue, "fixes and sparse annotations" tree is finally
going public. This version is basically a starting point - there will be much more stuff to merge.
Right now it builds with allmodconfig[1] on the following set:
alpha (UP and SMP), amd64 (UP and SMP), arm (RPC, versatile), i386, ia64, m32r, m68k (sans sun3), ppc (6xx, 44x, chestnut), ppc64, sparc, sparc64, s390 (31 and 64bit) and uml (i386 and amd64)[2].
Amount of sparse and gcc4 warnings is moderate on all of the
above - there's no "drowns everything in noise" stuff left. There _are_ nasty areas (drm, some of the sata, several mem* helpers with constant arguments), but at least that's easy to isolate. Tracking build log changes for regressions had been fairly easy so far; quite a few chunks in there (as well as already merged stuff) had been found that way, so for now I'd say that it's usable.
Current patchset is on ftp.linux.org.uk/pub/people/viro/ -
patch-2.6.13-git3-bird1.bz2 is combined patch, patchset/* is the splitup. Long description of patches is in patchset/set*, short log is in the end of this posting. Current build and sparse logs are in logs/*/{log17b,S-log17b}. Eventually I'll probably have to use rcs for them - they are large and change slowly...
Patchset will change pretty fast; for one thing, most of the stuff
in there is easily mergable, for another - sparse patches here are just dealing with the most annoying noise sources. There will be more and folks are more than welcome to send sane annotation patches for merge.
Have fun - it's just getting started...
[1] configs being tracked are of allmodconfig-with-fixed-subset variety; e.g. alpha-UP is "set as much as possible to y or m, with CONFIG_SMP not set", etc. See config/* for currently tracked ones.
[2] toolkit for cross-toolchains will be re-posted on anonftp pretty soon; ditto for details on cross-build setups, etc.
Short log of the current patchset follows:
----------------------------------------------------------------------------
linus-delta Changes in Linus' tree since -git3
Infrastructure:
I0-kconfig Teaches allmodconfig to pin a set of options in given
state [NB: rz has another variant; this is just a temporary]
I1-CHECKFLAGS Allows to add stuff to CHECKFLAGS from command line
I2-disable-DI disables CONFIG_DEBUG_INFO for test builds
Kconfig fixes:
B2-rio rio is too broken to mess with; marked as such
B7-floppy sanitized and fixed floppy dependencies
B12-broken-on-big-endian new kconfig symbol: BROKEN_ON_BIG_ENDIAN.
B17-m32r-smc combination of M32R, SMC91X and ISA is broken
B22-mtd-xip MTD_XIP is there only for two subarchitectures of ARM - PXA
and SA1100 [not for merge; cleaner variant needed]
B23-8390 8390 fixes - part 1 (generic and arm/etherh)
B33-m68k-8390 8390 fixes - part 2 (m68k ones)
B41-s390-phy PHYLIB is broken on s390
B42-mga drm/mga is broken if AGP is not enabled
Pure compile fixes:
C0-envctrl envctrl fixes
C15-mv643xx_eth mv643xx_eth ifdefs [not for merge; dwmw2 has objections]
C32-segment missed gratitious includes of asm/segment.h
B40-mxser-sparc32 more sparc32 dependencies fallout
C33-mxser another missed asm/segment.h, real fix for problem B40 marks
C34-uli526x missing include in uli526x.c
C35-ipw2200 missing include (ipw2200)
C36-sunsu sunsu compile fixes
Misc bug fixes:
F6-zatm dereference of uninitialized pointer in zatm
Crap spotted by gcc and sparse:
O3-s2io-u64 s2io u64 use for uintptr_t
S0-chelsio chelsio sparse annotations
S1-e1000 iomem annotations (e1000)
S2-s2io-iomem iomem annotations (s2io)
S3-ipw2100 iomem annotations, NULL noise removal (ipw2100)
S4-scsi-ch __user annotations (drivers/scsi/ch.c)
S5-ahci iomem annotations (ahci)
S6-sata_nv iomem annotations (sata_nv)
S7-sata_sx4 iomem annotations (sata_sx4)
S8-sata_qstor enum safety (sata_qstor)
S9-aaci iomem annotations (aaci)
S10-ethtool __user annotations (ethtool)
S14-m32r-user basic __user annotations (m32r)
S15-armv-iomem basic iomem annotations (arm-versatile)
S16-m32r-iomem missing basic iomem annotations (m32r)
S17-ia64-user missing basic __user annotations (ia64)
S18-rpc-iomem saner casts in arm-rpc IOMEM()
S19-sparse-m32r pass definition of __BIG_ENDIAN__ to sparse (m32r)
m68k patches:
C16-dmasound-lvalues lvalues abuse in dmasound
C17-dmasound-extern compile fixes for dmsound (static vs. extern)
C18-sun3ints static vs. extern in sun3ints.h
C19-sun3_pgtable bogus function argument types (sun3_pgtable.h)
C20-amigaints static vs. extern in amigaints.h
C21-atyfb-typo dumb typo in atyfb
C22-mac8390 lvalues abuse in mac8390
C23-lance lvalues abuse in lance
C24-82596-apricot wrong ifdefs in 82596
C25-scc static vs. extern in scc
C26-m68k-reset memory input should be an lvalue (mac/misc.c)
C27-m68k-mul broken constraints on mulu.l
C28-isa_type isa_{type,sex} should be exported (m68k)
B34-oktagon oktagon makefile fix
B35-82596 Kconfig fix (82596)
B36-mac-fonts Kconfig fix (mac vs. FONTS)
T0-task_thread_info task_thread_info - part 1/5
T1-other-helpers task_thread_info - part 2/5
T2-includes task_thread_info - part 3/5
T3-m68k task_thread_info - part 4/5
T4-m68k-flags task_thread_info - part 5/5
m68k-adb.patch ADBREQ_RAW missing declaration (from m68k CVS)
S11-m68k-iomem basic iomem annotations (m68k)
S13-m68k-user basic __user annotations (m68k)
C37-amigahw gratitious namespace pollution in amigahw
UML patches:
jd1 -- jd9 Pending patches from jdike's 9-patch set
S12-uml-user basic __user annotations (uml)
UM1-stubs [UML] segv_stubs fixes
UM2-signal [UML] copy_sc_..._user_tt() fixes
UM4-uml-checker [UML] getting sparse to work for uml
Quoted 8 lines · On Mon, Sep 05, 2005 at 04:58:48AM +0100, [email protected] wrote:
While waaaaay overdue, "fixes and sparse annotations" tree is finally
going public. This version is basically a starting point - there will be much more stuff to merge.Current patchset is on ftp.linux.org.uk/pub/people/viro/ -
patch-2.6.13-git3-bird1.bz2 is combined patch, patchset/* is the splitup. Long description of patches is in patchset/set*, short log is in the end of this posting. Current build and sparse logs are in logs/*/{log17b,S-log17b}.
Those who want to help with endian annotations (sparse -Wbitwise) are welcome at ftp://ftp.berlios.de/pub/linux-sparse/logs/
[allmodconfig + CONFIG_DEBUG_INFO=n] x [alpha, i386, parisc, ppc, ppc64, s390, sh, sh64, sparc, sparc64, x86_64]
-git5 is compiling right now.
[email protected]
maintainerQuoted 10 lines · Alexey Dobriyan
Quoted 8 lines · On Mon, Sep 05, 2005 at 04:58:48AM +0100, [email protected] wrote:
While waaaaay overdue, "fixes and sparse annotations" tree is finally
going public. This version is basically a starting point - there will be much more stuff to merge.Current patchset is on ftp.linux.org.uk/pub/people/viro/ -
patch-2.6.13-git3-bird1.bz2 is combined patch, patchset/* is the splitup. Long description of patches is in patchset/set*, short log is in the end of this posting. Current build and sparse logs are in logs/*/{log17b,S-log17b}.
Quoted 7 lines
Those who want to help with endian annotations (sparse -Wbitwise) are welcome at ftp://ftp.berlios.de/pub/linux-sparse/logs/
[allmodconfig +
CONFIG_DEBUG_INFO=n] x [alpha, i386, parisc, ppc, ppc64, s390, sh, sh64, sparc, sparc64,x86_64]-git5 is compiling right now.
-git5 has additional breakage:
* s390 crypto is b0rken; removal of workqueue that doesn't exist
* ppc44x missed s/u3/pm_message_t/
* sparc64 Kconfig changes need to be compensated for in drivers/char
Plus m68k and uml stuff need updates.
I'll post the updated patchset in a few and start clean rebuild; then the logs will go.
[email protected]
maintainerPATCH 1/1 2.6.13-git5-bird1
Quoted 5 lines
Quoted 4 lines
[allmodconfig +
CONFIG_DEBUG_INFO=n] x [alpha, i386, parisc, ppc, ppc64, s390, sh, sh64, sparc, sparc64,x86_64]-git5 is compiling right now.
Quoted 8 lines
-git5 has additional breakage:
* s390 crypto is b0rken; removal of workqueue that doesn't exist
* ppc44x missed s/u3/pm_message_t/
* sparc64Kconfigchanges need to be compensated for indrivers/char
Plus m68k and uml stuff need updates.I'll post the updated patchset in a few and start clean rebuild; then the logs will go.
OK, updated patchset in the same place:
ftp.linux.org.uk:/pub/people/viro/patchset/ ftp.linux.org.uk:/pub/people/viro/patch-2.6.13-git5-bird1.bz2
Old splitup had been moved to patchset-RC13-git3.
Changes:
* F6-zatm and B40-mxser-sparc32 merged upstream
* jd1--jd9 are partially merged, partially dropped - when Jeff posts
new set, it will get it.
* UM1-segv-stubs reduced to one chunk - that got missed in the
upstream merge
* UM2-signal merged upstream
* T4-m68k-flags updated due to m68k ptrace.c indent patch upstream.
Added:
* B43-serial gratitious includes of asm/serial.h in drivers/char
* B44-genrtc genrtc is not for sparc64
* C38-ppc44x-pm missed s/u32/pm_message_t/ in arch/ppc/syslib/ocp.c
* C39-s390 temporary fix for s390 mismerge
[email protected]
maintainerPATCH 1/1 2.6.13-git5-bird2
With several more patches (mostly - sparse regression fixing); same place, ftp.linux.org.uk/pub/people/viro/{patch-2.6.13-git5-bird2.bz,patchset}
Added:
* O4-dm9000 missed s/u32/pm_message_t/ (dm9000)
* S20-wdt __user annotations (booke_wdt.c)
* S21-cx88 __user annotations (cx88-video.c)
* S22-ac3200 iomem annotations (ac3200.c)
* S23-forcedeth __user annotations (forcedeth.c)
* S24-proc NULL noise removal (proc/task_mmu.c)
* S25-page_alloc missing prototype (mm/page_alloc.c)
Logs are on ftp.linux.org.uk/pub/people/viro/logs/*log18a (gcc and sparse).
Looking some more into Alexey's sunrpc patch, have not merged yet...
[email protected]
maintainerPATCH 1/1 2.6.13-git7-bird1
Patchset moved to -git7. News:
* sparse arguments fixed on ppc64 (dealt with regression)
* -Wundef gcc warnigns all dealt with on tracked targets
Note that sparse -Wundef is broken; logs this time are with sparse wrapper that rips -Wundef from its arguments.
Patch is on ftp.linux.org.uk/pub/peole/viro/patch-2.6.13-git7-brid1.bz2, its splitup is in usual place and logs are in logs/*/*log19.
Added:
S26-ppc64-sparse CHECKFLAGS on ppc64 got broken
C40-elf_class bogus symbol used in elf_aux.c
C41-xfs XFS __...._ENDIAN -Wundef warnings
O5-m68k-hardirq (m68k) hardirq checks were in wrong place
O6-simserial bogus #if (simserial)
O7-uml-mem bogus #if (arch/um/kernel/mem.c)
O8-hisax -Wundef fixes (hisax)
O9-smc-undef bogus #if (smc91x)
O10-ncr5380 -Wundef fixes (ncr5380)
O11-hamachi -Wundef fixes (hamachi)
O12-ncr53c406 bogus #if (ncr53c406)
Merged upstream:
B35-82596
B41-s390-phy
B44-genrtc
C33-mxser
C34-uli526x
C36-sunsu
S0-chelsio
S1-e1000
S2-s2io-iomem
S3-ipw2100
S10-ethtool
Updated:
S5-ahci
S7-sata_sx4
C39-s390
Al Viro
maintainerPATCH 1/1 2.6.13-git12-bird1
Patchset moved to -git12. News:
* playing catch-up with spinlock changes (m68k build got broken)
* playing catch-up with kbuild changes (arm, uml)
* usual assorted build fixes
* assorted sparse annotations
* beginning of endianness annotations merge: RPC patches from Alexey
* beginning of linux/irq.h work
Patch is in usual place. Patch itself is patch-2.6.13-git12-bird1.bz2, splitup is in patchset/, logs in logs/*/*log21c.
Shortlog follows.
Alexey Dobriyan:
* sunrpc endianness annotations
* lockd endianness annotations
* nfs endianness annotations
Russell King:
* assorted arm annotations
Al Viro:
* C99 initializers (ray_cs)
* OUTPUT_ARCH() on ppc should be powerpc:common
* UML early build sanitized
* __iomem annotations (epca)
* __iomem annotations (i810-i2c)
* __iomem annotations (sata_promise)
* __iomem annotations (sata_sil)
* __iomem annotations (sata_vsc)
* __user annotations (saa6588)
* beginning of linux/irq.h cleanup - amd64
* bogus casts in lne390
* cyblafb: portability fixes, sanitized work with pointers
* fixed dependency in early arm build
* ibm_emac annotations
* missing include (cs89x0)
* s2io: use %p, damnit...
* sparc exports: no more wanking with weak aliases for .div et.al.
* trivial sparse warnings in net/*
* uml kconfig sanitized around drivers/net
* updated m68k vmlinux.lds to include LOCK_TEXT
Al Viro
maintainerRe: [PATCHSET] 2.6.13-git12-bird1
Quoted 8 lines · Al Viro
Patchset moved to -git12. News:
* playing catch-up with spinlock changes (m68k build got broken)
* playing catch-up with kbuild changes (arm, uml)
* usual assorted build fixes
* assorted sparse annotations
* beginning of endianness annotations merge: RPC patches from Alexey
* beginning oflinux/irq.hwork
Quoted 4 lines
Patch is in usual place. Patch itself is patch-2.6.13-git12-bird1.bz2, splitup is in patchset/, logs in logs/*/*log21c.
Shortlog follows.
... Actually, that would be "Shortlog of additions since the last posted version".
PATCH 1/1 2.6.14-rc2-git8-bird1
Patchset againts 2.6.14-rc2-git8 (closer to -git9, actually -
the first part of patchset is delta between -git8 and Linus' tree slightly before -git9).
A lot of stuff got through the patchset since the last posting,
generally it stays pretty close to mainline.
Builds on the same set of targets.
Patch is on ftp.linux.org.uk/pub/people/viro/patch-2.6.14-rc2-git8-bird1.bz2, splitup in ftp.linux.org.uk/pub/people/viro/patchset, logs (gcc and sparse) in ftp.linux.org.uk/pub/people/viro/logs/*log23e
Current list of patches is in .../patchset/set*.
kernel cross-toolchain (FC4)
Easy cross-toolchain for kernel
Requirements:
* should be built from the same source as native toolchain with
minimal patches
* should produce normal packages
* should be buildable with minimal PITA in reasonable time
* package metadata can (and obviously will) differ, but delta should
be minimal and easy to maintain
Recipe for FC4 follows; feel free to contribute equivalents for other platforms.
1) Grab binutils-2.15.94.0.2.2, gcc-4.0.1-4.fc4, glibc-kernheaders-2.4-9.1.94 and glibc-2.3.5-10.3 SRPMs from any mirror (i.e. sources for native toolchain). Install them (rpm -i .....src.rpm).
2) grab ftp.linux.org.uk/pub/people/viro/cross-build/*
3) out of the above, drop binutils*.patch into the SOURCES directory where rpm had left vanilla binutils source
4) sh build-binutils and install resulting rpms (binutils-<target>)
5) sh build-kern_headers and install resulting rpms (glibc-kernheaders-{alpha,ia64})
6) sh build-libc-headers and install resulting rmps (libc-headers-{alpha,ia64})
7) sh build-gcc and install the results (gcc-<target>, cpp-<target>)
List of targets to build in is file called, surprisingly, "targets". libc headers are needed only for alpha and ia64; if you don't need those, ignore
(5) and (6).
kernel cross-toolchain (Gentoo)
Quoted 10 lines · Al Viro
Easy cross-toolchain for kernel
Requirements:
* should be built from the same source as native toolchain with
minimal patches
* should produce normal packages
* should be buildable with minimal PITA in reasonable time
* package metadata can (and obviously will) differ, but delta should
be minimal and easy to maintain
Quoted 2 lines
Recipe for FC4 follows; feel free to contribute equivalents for other platforms.
Gentoo:
1) Watch for it to install gcc 3.4.*. Chances of successful build are much higher than with 3.3. Use --g switch of crossdev (_especially_ with s390).
2) -s1 means "binutils + C compiler and nothing more".
3) re ia64
I was told that "ia64 is known to not cross compile at all due to the unwind code". #101626.
4) re m68k
binutils only. Haven't investigated.
5) re mips64
Ditto.
6) re mips
Builds OK. Naive allyesconfig with CROSS_COMPILE=mips-... barfs at me violently mentioning some compiler switches.
The following is the list of cross-compilers I successfully use on -git snapshots. Again, watch for the script to install 3.4.4[-r1]. Always use "crossdev -p ..." first.
# emerge crossdev # echo 'PORTDIR_OVERLAY="/usr/local/portage"' >>/etc/make.conf # crossdev -v -s1 -t alpha-unknown-linux-gnu # crossdev -v -s1 -t arm-unknown-linux-gnu # crossdev -v -s1 -t hppa-unknown-linux-gnu # crossdev -v -s1 -t s390-unknown-linux-gnu # crossdev -v -s1 -t powerpc-unknown-linux-gnu # crossdev -v -s1 -t powerpc64-unknown-linux-gnu # crossdev -v -s1 -t sparc-unknown-linux-gnu # crossdev -v -s1 -t sparc64-unknown-linux-gnu # crossdev -v -s1 -t sh-unknown-linux-gnu # crossdev -v -s1 -t sh64-unknown-linux-gnu # crossdev -v -s1 -t x86_64-unknown-linux-gnu
Re: kernel cross-toolchain (Gentoo)
Quoted 3 lines · Alexey Dobriyan
1) Watch for it to install gcc 3.4.*. Chances of successful build are much higher than with 3.3. Use --g switch of crossdev (_especially_ with s390).
Umm... Is crossdev toolchain with target==host the same as native one?
Quoted 3 lines
3) re ia64
I was told that "ia64 is known to not cross compile at all due to the unwind code". #101626.
*snerk* Read: needs libc headers for ia64.
Quoted 2 lines
4) re m68k
binutils only. Haven't investigated.
Oh? Both FC4 (4.0.1) and sarge (3.3.5) handle it without any complications
Quoted 2 lines
5) re mips64
Ditto.
Same as above
Quoted 3 lines
6) re mips
Builds OK. Naive allyesconfig with CROSS_COMPILE=mips-... barfs at me violently mentioning some compiler switches.
mips in mainline doesn't build.
Quoted 2 lines
# crossdev -v -s1 -t powerpc-unknown-linux-gnu # crossdev -v -s1 -t powerpc64-unknown-linux-gnu
Actually, powerpc64 can handle ppc32...
Quoted 2 lines
# crossdev -v -s1 -t sparc-unknown-linux-gnu # crossdev -v -s1 -t sparc64-unknown-linux-gnu
Same story.
Re: kernel cross-toolchain (Gentoo)
Quoted 6 lines · Al Viro
Quoted 3 lines · Alexey Dobriyan
1) Watch for it to install gcc 3.4.*. Chances of successful build are much higher than with 3.3. Use --g switch of crossdev (_especially_ with s390).
Umm... Is crossdev toolchain with target==host the same as native one?
Not sure what do you mean... Native gcc here is 3.3.6.
# crossdev -p -v -s1 -t i686-unknown-linux-gnu
will install binutils-2.16.1 and gcc-3.4.4.
Re: kernel cross-toolchain (Gentoo)
Quoted 6 lines · Alexey Dobriyan
Quoted 5 lines · Al Viro
Quoted 3 lines · Alexey Dobriyan
1) Watch for it to install gcc 3.4.*. Chances of successful build are much higher than with 3.3. Use --g switch of crossdev (_especially_ with s390).
Quoted 7 lines
Quoted 1 line
Umm... Is crossdev toolchain with target==host the same as native one?
Not sure what do you mean... Native gcc here is 3.3.6.
# crossdev -p -v -s1 -t i686-unknown-linux-gnuwill install binutils-2.16.1 and gcc-3.4.4.
... then we have a problem. The point is to get build coverage equivalent to native builds. Cross-toolchain out of sync with native one means PITA in that respect.
Re: kernel cross-toolchain (Gentoo)
Quoted 6 lines · Al Viro
Quoted 5 lines · Alexey Dobriyan
Quoted 1 line · Al Viro
Umm... Is crossdev toolchain with target==host the same as native one?
Not sure what do you mean... Native gcc here is 3.3.6.
Quoted 7 lines
Quoted 3 lines
# crossdev -p -v -s1 -t i686-unknown-linux-gnuwill install binutils-2.16.1 and gcc-3.4.4.
... then we have a problem. The point is to get build coverage equivalent to native builds. Cross-toolchain out of sync with native one means PITA in that respect.
[if I don't understand something ameba can understand, I preventively
apologize and ask to explain.]
1) supported compilers are (effectively?):
2.95.3 + %z patch, 3.3.*, 3.4.*, 4.0.1+.
2) build breakage on one of supported compilers is supposed to be reported and fixed.
3) I can easily install gcc 3.4 with one "emerge" invocation. No problem at all. After reading some docs to 4.0.$WHATEVER.
4) arm (other archs?) people mostly use cross-compilers (don't have rmk quote handy).
At this point I do not understand fundamental difference of "native build" from cross build. Consequently I do not understand a problem with native toolchains being different from cross ones. In my case, it is still FSF GCC, no stack protection, ... patches.
Even more: you (and, to some extent, me), being a cross-compile farmer, can't test if
CONFIG_S390=y CONFIG_S390X=n CONFIG_CHECK_STACK=n (made up example, pick another config if you _can_ test)
boots and works fine. All you can do is to test is a config builds OK, leaving the rest to folks who have the hardware.
Again, if I don't understand something very obvious, please, explain.
Re: kernel cross-toolchain (Gentoo)
In reply to Al ViroQuoted 5 lines · Al Viro
Quoted 2 lines · Alexey Dobriyan
4) re m68k
binutils only. Haven't investigated.Oh? Both FC4 (4.0.1) and sarge (3.3.5) handle it without any complications
Duh... 3.3.6 for m68k builds just fine.
PATCH 1/1 2.6.14-rc3-git4-bird1
In reply to Al ViroPatchset againts 2.6.14-rc3-git4
* a pile of patches merged upstream
* usual build regression fixes traffic.
* ibmtr.c: bogus kfree() on some failure exits.
* more UML makefiles cleanups (for post-2.6.14)
* BFS: endianness annotations (Alexey) and killing iget() abuses (me).
Patch is on ftp.linux.org.uk/pub/people/viro/patch-2.6.14-rc3-git4-bird1.bz2, splitup in ftp.linux.org.uk/pub/people/viro/patchset, logs (gcc and sparse) in ftp.linux.org.uk/pub/people/viro/logs/*log24a
Current list of patches is in .../patchset/set*.
Re: [PATCHSET] 2.6.14-rc3-git4-bird1
arch/arm/mm/consistent.c
Quoted 10 lines
arch/arm/mm/consistent.c +3
-3-vm_region_alloc(struct vm_region *head, size_t size, int gfp) +vm_region_alloc(struct vm_region *head, size_t size, unsigned int gfp) -__dma_alloc (struct device *dev,size_t size, dma_addr_t *handle,int gfp, - pgprot_t prot) +__dma_alloc (struct device *dev,size_t size, dma_addr_t *handle, +unsigned int gfp, pgprot_t prot)
unsigned int __nocast gfp
=> dma_alloc_coherent
=> dma_alloc_writecombine
[RFC] gfp flags annotations
Quoted 13 lines · Alexey Dobriyan
arch/arm/mm/consistent.c
Quoted 10 lines
arch/arm/mm/consistent.c +3
-3-vm_region_alloc(struct vm_region *head, size_t size, int gfp) +vm_region_alloc(struct vm_region *head, size_t size, unsigned int gfp) -__dma_alloc (struct device *dev,size_t size, dma_addr_t *handle,int gfp, - pgprot_t prot) +__dma_alloc (struct device *dev,size_t size, dma_addr_t *handle, +unsigned int gfp, pgprot_t prot)unsigned int
__nocastgfp
Quoted 2 lines
=>
dma_alloc_coherent
=>dma_alloc_writecombine
Speaking of that... IMO we should do the following:
a) typedef unsigned int __nocast gfp_t;
b) replace __nocast uses for gfp flags with gfp_t - it gives exactly the same warnings as far as sparse is concerned, doesn't change generated code and documents what's going on far better. If we are using __nocast for anything else - sure, let it stay.
c) then replace __nocast in declaration of gfp_t with __bitwise [*], add force cast to gfp_t to definitions of __GFP_... and deal with resulting warnings.
Note that unlike __nocast, __bitwise is hard to lose; lossage like the above will not go unnoticed. We will need a couple of inline helpers to deal with extraction of zone from gfp, etc., but after that it's basically a matter of switching the missed chunks like the above.
I've done that several months ago, but that patch series had been killed by bitrot (patches fixing the bugs I've found back then had been merged, the rest had gone to bitbucket after a while). It's not hard to reproduce, though.
Objections?
[*] since endainness annotations are nowhere near complete, I suggest the following: define __bitwise__ as __attribute__((bitwise)) or empty, depending on __CHECKER__, then have
#ifdef __CHECK_ENDIAN__
#define __bitwise __bitwise__
#else
#define __bitwise
#endif
typedef unsigned int __bitwise__ gfp_t;
with -Wbitwise unconditionally in CHECKFLAGS. Then normal run will pick the places that use __bitwise__ and CF=-D__CHECK_ENDIAN__ will pick all endianness warnings on top of that. Basically, that allows to use bitwise annotations while endianness stuff is not finished and do that without drowning in warnings.
Re: [RFC] gfp flags annotations
Quoted 11 lines · Al Viro
Speaking of that... IMO we should do the following:
a) typedef unsigned int
__nocastgfp_t;
b) replace__nocastuses for gfp flags withgfp_t- it gives exactly the same warnings as far as sparse is concerned, doesn't change generated code and documents what's going on far better. If we are using__nocastfor anything else - sure, let it stay.
c) then replace__nocastin declaration ofgfp_twith__bitwise[*], add force cast togfp_tto definitions of__GFP_... and deal with resulting warnings.
Quoted 1 line
Objections?
None from me, this will be a good thing to have.
thanks,
greg k-h
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [PATCH] gfp flags annotations - part 1
drivers/s390/scsi/zfcp_aux.c
Quoted 9 lines · Al Viro
drivers/s390/scsi/zfcp_aux.c +1
-1static void * -zfcp_mempool_alloc (unsigned int __nocast gfp_mask,void *size) +zfcp_mempool_alloc (gfp_t gfp_mask,void *size) {return kmalloc ((size_t ) size, gfp_mask); }
Lovely. Yes, they cast sizeof() to void * in all calls.
Re: [PATCH] gfp flags annotations - part 1
Quoted 11 lines
drivers/s390/scsi/zfcp_aux.c
Quoted 9 lines
drivers/s390/scsi/zfcp_aux.c +1
-1static void * -zfcp_mempool_alloc (unsigned int __nocast gfp_mask,void *size) +zfcp_mempool_alloc (gfp_t gfp_mask,void *size) {return kmalloc ((size_t ) size, gfp_mask); }Lovely. Yes, they cast
sizeof()to void * in all calls.
zfcp_mempool_alloc needs to fit the prototype of mempool_alloc_t. If you have a better idea to implement a mempool, please let us know. The calls you mention are actually calls to mempool_create and not to zfcp_mempool_alloc, or are you talking about something different?
Heiko
Re: [PATCH] gfp flags annotations - part 1
Quoted 5 lines · Heiko Carstens
zfcp_mempool_allocneeds to fit the prototype ofmempool_alloc_t. If you have a better idea to implement a mempool, please let us know. The calls you mention are actually calls tomempool_createand not tozfcp_mempool_alloc, or are you talking about something different?
Ouch. I'll shut up now.
Re: [RFC] gfp flags annotations
In reply to Al ViroQuoted 2 lines · Al Viro
a) typedef unsigned int
__nocastgfp_t;
Btw, since you did a typedef, any reason why it isn't marked __bitwise too? It would seem that all valid uses of it are bit tests with predefined values, ie a __bitwise restriction would seem very natural, no?
Linus
Re: [RFC] gfp flags annotations
Quoted 6 lines · Linus Torvalds
Quoted 1 line · Al Viro
a) typedef unsigned int
__nocastgfp_t;Btw, since you did a typedef, any reason why it isn't marked
__bitwisetoo? It would seem that all valid uses of it are bit tests with predefined values, ie a__bitwiserestriction would seem very natural, no?
See [*] in Al's RFC.
The amount of endian warnings on allmodconfig is in >10K range. gfp_t ones would simply be lost in noise.
Re: [RFC] gfp flags annotations
Quoted 4 lines · Alexey Dobriyan
Quoted 3 lines · Linus Torvalds
Quoted 1 line · Al Viro
a) typedef unsigned int
__nocastgfp_t;
Quoted 8 lines
Quoted 3 lines
Btw, since you did a typedef, any reason why it isn't marked
__bitwisetoo? It would seem that all valid uses of it are bit tests with predefined values, ie a__bitwiserestriction would seem very natural, no?See [*] in Al's RFC.
The amount of endian warnings on allmodconfig is in >10K range.
gfp_tones would simply be lost in noise.
I've done that in the latter chunks, will send the next few in about half an hour...
RFC 1/1 gfp flags annotations - part 2
In reply to Linus Torvalds - renamed __bitwise to __bitwise__
- made __bitwise conditional on __CHECK_ENDIAN__
- made gfp_t __bitwise__
- added -Wbitwise to CHECKFLAGS
As the result, default sparse run will pick gfp warnings without picking endianness ones; to get those use CF=-D__CHECK_ENDIAN__.
That allows to do gfp annotations without drowning in endianness ones - endianness annotations are nowhere near complete and generate too much noise.
- __GFP_... definitions got a force-cast to gfp_t
- new helper - gfp_zone(gfp) gives zone number.
Impact on the things seen by gcc - none; the only thing that survives preprocessor is addition of cast to unsigned int on several explicitly unsigned constants.
----
Makefile +1 -1
@@ -334,7 +334,7 @@ PERL = perl CHECK = sparse -CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ $(CF) +CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ -Wbitwise $(CF) MODFLAGS = -DMODULE CFLAGS_MODULE = $(MODFLAGS) AFLAGS_MODULE = $(MODFLAGS)
fs/buffer.c +1 -1
@@ -502,7 +502,7 @@yield ();for_each_pgdat (pgdat) { - zones = pgdat->node_zonelists[GFP_NOFS &GFP_ZONEMASK ].zones; + zones = pgdat->node_zonelists[gfp_zone (GFP_NOFS )].zones;if (*zones)try_to_free_pages (zones,GFP_NOFS ); }
include/linux/gfp.h +20 -19
@@ -12,8 +12,8 @@* GFP bitmasks.. */ /* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low two bits) */ -#define __GFP_DMA 0x01u -#define __GFP_HIGHMEM 0x02u +#define __GFP_DMA ((__force gfp_t)0x01u) +#define __GFP_HIGHMEM ((__force gfp_t)0x02u)/* * Action modifiers - doesn't change the zoning
@@ -26,24 +26,24 @@* * __GFP_NORETRY: The VM implementation must not retry indefinitely. */ -#define __GFP_WAIT 0x10u/* Can wait and reschedule? */ -#define __GFP_HIGH 0x20u/* Should access emergency pools? */ -#define __GFP_IO 0x40u/* Can start physical IO? */ -#define __GFP_FS 0x80u/* Can call down to low-level FS? */ -#define __GFP_COLD 0x100u/* Cache-cold page required */ -#define __GFP_NOWARN 0x200u/* Suppress page allocation failure warning */ -#define __GFP_REPEAT 0x400u/* Retry the allocation. Might fail */ -#define __GFP_NOFAIL 0x800u/* Retry for ever. Cannot fail */ -#define __GFP_NORETRY 0x1000u/* Do not retry. Might fail */ -#define __GFP_NO_GROW 0x2000u/* Slab internal usage */ -#define __GFP_COMP 0x4000u/* Add compound page metadata */ -#define __GFP_ZERO 0x8000u/* Return zeroed page on success */ -#define __GFP_NOMEMALLOC 0x10000u/* Don't use emergency reserves */ -#define __GFP_NORECLAIM 0x20000u/* No realy zone reclaim during allocation */ -#define __GFP_HARDWALL 0x40000u/* Enforce hardwall cpuset memory allocs */ +#define __GFP_WAIT ((__force gfp_t)0x10u)/* Can wait and reschedule? */ +#define __GFP_HIGH ((__force gfp_t)0x20u)/* Should access emergency pools? */ +#define __GFP_IO ((__force gfp_t)0x40u)/* Can start physical IO? */ +#define __GFP_FS ((__force gfp_t)0x80u)/* Can call down to low-level FS? */ +#define __GFP_COLD ((__force gfp_t)0x100u)/* Cache-cold page required */ +#define __GFP_NOWARN ((__force gfp_t)0x200u)/* Suppress page allocation failure warning */ +#define __GFP_REPEAT ((__force gfp_t)0x400u)/* Retry the allocation. Might fail */ +#define __GFP_NOFAIL ((__force gfp_t)0x800u)/* Retry for ever. Cannot fail */ +#define __GFP_NORETRY ((__force gfp_t)0x1000u)/* Do not retry. Might fail */ +#define __GFP_NO_GROW ((__force gfp_t)0x2000u)/* Slab internal usage */ +#define __GFP_COMP ((__force gfp_t)0x4000u)/* Add compound page metadata */ +#define __GFP_ZERO ((__force gfp_t)0x8000u)/* Return zeroed page on success */ +#define __GFP_NOMEMALLOC ((__force gfp_t)0x10000u)/* Don't use emergency reserves */ +#define __GFP_NORECLAIM ((__force gfp_t)0x20000u)/* No realy zone reclaim during allocation */ +#define __GFP_HARDWALL ((__force gfp_t)0x40000u)/* Enforce hardwall cpuset memory allocs */ #define __GFP_BITS_SHIFT 20/* Room for 20 __GFP_FOO bits */ -#define __GFP_BITS_MASK ((1 << __GFP_BITS_SHIFT) - 1) +#define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))/* if you forget to add the bitmask here kernel will crash, period */ #define GFP_LEVEL_MASK (__GFP_WAIT|__GFP_HIGH|__GFP_IO|__GFP_FS| \
@@ -64,6 +64,7 @@#define GFP_DMA __GFP_DMA +#define gfp_zone (mask) ((__force int)((mask) & (__force gfp_t)GFP_ZONEMASK))/* * There is only one page-allocator function, and two main namespaces to
@@ -94,7 +95,7 @@return NULL ;return __alloc_pages (gfp_mask, order, -NODE_DATA (nid)->node_zonelists + (gfp_mask &GFP_ZONEMASK )); +NODE_DATA (nid)->node_zonelists +gfp_zone (gfp_mask)); }#ifdef CONFIG_NUMA
include/linux/types.h +7 -2
@@ -151,7 +151,12 @@*/ #ifdef __CHECKER__ -#define __bitwise __attribute__((bitwise)) +#define __bitwise__ __attribute__((bitwise)) +#else +#define __bitwise__ +#endif +#ifdef __CHECK_ENDIAN__ +#define __bitwise __bitwise__#else #define __bitwise#endif
@@ -166,7 +171,7 @@#endif #ifdef __KERNEL__ -typedef unsigned __nocast gfp_t ; +typedef unsigned __bitwise__ gfp_t ;#endif struct ustat {
mm/mempolicy.c +3 -3
@@ -700,7 +700,7 @@case MPOL_BIND :/* Lower zones don't get a policy applied */ /* Careful: current->mems_allowed might have moved */ -if ((gfp &GFP_ZONEMASK ) >= policy_zone) +if (gfp_zone (gfp) >= policy_zone)if (cpuset_zonelist_valid_mems_allowed (policy->v.zonelist))return policy->v.zonelist;/*FALL THROUGH*/
@@ -712,7 +712,7 @@ nd =0 ;BUG (); } -return NODE_DATA (nd)->node_zonelists + (gfp &GFP_ZONEMASK ); +return NODE_DATA (nd)->node_zonelists +gfp_zone (gfp); }/* Do dynamic interleaving for a process */
@@ -757,7 +757,7 @@struct page *page;BUG_ON (!node_online (nid)); - zl =NODE_DATA (nid)->node_zonelists + (gfp &GFP_ZONEMASK ); + zl =NODE_DATA (nid)->node_zonelists +gfp_zone (gfp); page =__alloc_pages (gfp, order, zl);if (page &&page_zone (page) == zl->zones[0 ]) {zone_pcp (zl->zones[0 ],get_cpu ())->interleave_hit++;
mm/page_alloc.c +2 -2
@@ -1089,7 +1089,7 @@*/ unsigned int nr_free_buffer_pages (void ) { -return nr_free_zone_pages (GFP_USER &GFP_ZONEMASK ); +return nr_free_zone_pages (gfp_zone (GFP_USER )); }/*
@@ -1097,7 +1097,7 @@*/ unsigned int nr_free_pagecache_pages (void ) { -return nr_free_zone_pages (GFP_HIGHUSER &GFP_ZONEMASK ); +return nr_free_zone_pages (gfp_zone (GFP_HIGHUSER )); }#ifdef CONFIG_HIGHMEM
RFC 1/1 gfp flags annotations - part 3 (simple parts of mm/*)
In reply to Linus TorvaldsA bunch of unsigned int -> gfp_t in mm/*. All tricky parts
(zone handling) are left as-is - we'll deal with them later. This is just the missing annotations.
----
include/linux/mm.h +1 -1
@@ -747,7 +747,7 @@* The callback will be passed nr_to_scan == 0 when the VM is querying the * cache size, so a fastpath for that case is appropriate. */ -typedef int (*shrinker_t )(int nr_to_scan,unsigned int gfp_mask); +typedef int (*shrinker_t )(int nr_to_scan,gfp_t gfp_mask);/* * Add an aging callback. The int is the number of 'seeks' it takes
include/linux/pagemap.h +3 -3
@@ -69,7 +69,7 @@extern struct page *find_trylock_page (struct address_space *mapping,unsigned long index);extern struct page *find_or_create_page (struct address_space *mapping, -unsigned long index,unsigned int gfp_mask); +unsigned long index,gfp_t gfp_mask);unsigned find_get_pages (struct address_space *mapping,pgoff_t start,unsigned int nr_pages,struct page **pages); unsigned find_get_pages_tag(struct address_space *mapping, pgoff_t *index,
@@ -92,9 +92,9 @@ struct list_head *pages, filler_t *filler, void *data);int add_to_page_cache (struct page *page,struct address_space *mapping, -unsigned long index,int gfp_mask); +unsigned long index,gfp_t gfp_mask);int add_to_page_cache_lru (struct page *page,struct address_space *mapping, -unsigned long index,int gfp_mask); +unsigned long index,gfp_t gfp_mask);extern void remove_from_page_cache (struct page *page);extern void __remove_from_page_cache (struct page *page);
include/linux/slab.h +1 -1
@@ -121,7 +121,7 @@extern void *kmem_cache_alloc_node (kmem_cache_t *,gfp_t flags,int node);extern void *kmalloc_node (size_t size,gfp_t flags,int node);#else -static inline void *kmem_cache_alloc_node (kmem_cache_t *cachep,int flags,int node) +static inline void *kmem_cache_alloc_node (kmem_cache_t *cachep,gfp_t flags,int node) {return kmem_cache_alloc (cachep, flags); }
include/linux/swap.h +2 -2
@@ -171,8 +171,8 @@extern void swap_setup (void );/* linux/mm/vmscan.c */ -extern int try_to_free_pages (struct zone **,unsigned int ); -extern int zone_reclaim (struct zone *,unsigned int ,unsigned int ); +extern int try_to_free_pages (struct zone **,gfp_t ); +extern int zone_reclaim (struct zone *,gfp_t ,unsigned int );extern int shrink_all_memory (int );extern int vm_swappiness;
mm/filemap.c +4 -4
@@ -377,7 +377,7 @@* This function does not add the page to the LRU. The caller must do that. */ int add_to_page_cache (struct page *page,struct address_space *mapping, -pgoff_t offset,int gfp_mask) +pgoff_t offset,gfp_t gfp_mask) {int error =radix_tree_preload (gfp_mask & ~__GFP_HIGHMEM);
@@ -401,7 +401,7 @@EXPORT_SYMBOL (add_to_page_cache);int add_to_page_cache_lru (struct page *page,struct address_space *mapping, -pgoff_t offset,int gfp_mask) +pgoff_t offset,gfp_t gfp_mask) {int ret =add_to_page_cache (page, mapping, offset, gfp_mask);if (ret ==0 )
@@ -591,7 +591,7 @@* memory exhaustion. */ struct page *find_or_create_page (struct address_space *mapping, -unsigned long index,unsigned int gfp_mask) +unsigned long index,gfp_t gfp_mask) {struct page *page, *cached_page =NULL ;int err;
@@ -683,7 +683,7 @@ grab_cache_page_nowait(struct address_space *mapping, unsigned long index) {struct page *page =find_get_page (mapping, index); -unsigned int gfp_mask; +gfp_t gfp_mask;if (page) {if (!TestSetPageLocked (page))
mm/mempool.c +1 -1
@@ -205,7 +205,7 @@void *element;unsigned long flags;wait_queue_t wait; -unsigned int gfp_temp; +gfp_t gfp_temp;might_sleep_if (gfp_mask & __GFP_WAIT);
mm/shmem.c +2 -2
@@ -85,7 +85,7 @@static int shmem_getpage (struct inode *inode,unsigned long idx,struct page **pagep,enum sgp_type sgp,int *type); -static inline struct page *shmem_dir_alloc (unsigned int gfp_mask) +static inline struct page *shmem_dir_alloc (gfp_t gfp_mask) {/* * The above definition of ENTRIES_PER_PAGE, and the use of
@@ -898,7 +898,7 @@ }static struct page * -shmem_alloc_page (unsigned long gfp,struct shmem_inode_info *info, +shmem_alloc_page (gfp_t gfp,struct shmem_inode_info *info,unsigned long idx) {struct vm_area_struct pvma;
mm/slab.c +4 -4
@@ -386,7 +386,7 @@unsigned int gfporder;/* force GFP flags, e.g. GFP_DMA */ -unsigned int gfpflags; +gfp_t gfpflags;size_t colour;/* cache colouring range */ unsigned int colour_off;/* colour offset */
@@ -2117,7 +2117,7 @@ slabp->free =0 ; } -static void kmem_flagcheck (kmem_cache_t *cachep,unsigned int flags) +static void kmem_flagcheck (kmem_cache_t *cachep,gfp_t flags) {if (flags &SLAB_DMA ) {if (!(cachep->gfpflags &GFP_DMA ))
@@ -2152,7 +2152,7 @@struct slab *slabp;void *objp;size_t offset; -unsigned int local_flags; +gfp_t local_flags;unsigned long ctor_flags;struct kmem_list3 *l3;
@@ -2546,7 +2546,7 @@/* * A interface to enable slab creation on nodeid */ -static void *__cache_alloc_node (kmem_cache_t *cachep,int flags,int nodeid) +static void *__cache_alloc_node (kmem_cache_t *cachep,gfp_t flags,int nodeid) {struct list_head *entry;struct slab *slabp;
mm/vmscan.c +4 -4
@@ -70,7 +70,7 @@unsigned int priority;/* This context's GFP mask */ -unsigned int gfp_mask; +gfp_t gfp_mask;int may_writepage;
@@ -186,7 +186,7 @@* * Returns the number of slab objects which we shrunk. */ -static int shrink_slab (unsigned long scanned,unsigned int gfp_mask, +static int shrink_slab (unsigned long scanned,gfp_t gfp_mask,unsigned long lru_pages) {struct shrinker *shrinker;
@@ -921,7 +921,7 @@* holds filesystem locks which prevent writeout this might not work, and the * allocation attempt will fail. */ -int try_to_free_pages (struct zone **zones,unsigned int gfp_mask) +int try_to_free_pages (struct zone **zones,gfp_t gfp_mask) {int priority;int ret =0 ;
@@ -1333,7 +1333,7 @@/* * Try to free up some pages from this zone through reclaim. */ -int zone_reclaim (struct zone *zone,unsigned int gfp_mask,unsigned int order) +int zone_reclaim (struct zone *zone,gfp_t gfp_mask,unsigned int order) {struct scan_control sc;int nr_pages =1 << order;
RFC 1/1 gfp flags annotations - part 4 (lib/*)
In reply to Linus Torvalds missing gfp_t in lib/* and related headers
----
include/linux/idr.h +1 -1
@@ -71,7 +71,7 @@*/ void *idr_find (struct idr *idp,int id); -int idr_pre_get (struct idr *idp,unsigned gfp_mask); +int idr_pre_get (struct idr *idp,gfp_t gfp_mask);int idr_get_new (struct idr *idp,void *ptr,int *id);int idr_get_new_above (struct idr *idp,void *ptr,int starting_id,int *id);void idr_remove (struct idr *idp,int id);
include/linux/kobject.h +1 -1
@@ -65,7 +65,7 @@extern struct kobject *kobject_get (struct kobject *);extern void kobject_put (struct kobject *); -extern char *kobject_get_path (struct kobject *,int ); +extern char *kobject_get_path (struct kobject *,gfp_t );struct kobj_type {void (*release)(struct kobject *);
include/linux/radix-tree.h +1 -1
@@ -24,7 +24,7 @@struct radix_tree_root {unsigned int height; -unsigned int gfp_mask; +gfp_t gfp_mask;struct radix_tree_node *rnode; };
include/linux/textsearch.h +2 -2
@@ -40,7 +40,7 @@struct ts_ops {const char *name; -struct ts_config * (*init)(const void *,unsigned int ,int ); +struct ts_config * (*init)(const void *,unsigned int ,gfp_t );unsigned int (*find)(struct ts_config *,struct ts_state *);void (*destroy)(struct ts_config *);
@@ -148,7 +148,7 @@extern int textsearch_register (struct ts_ops *);extern int textsearch_unregister (struct ts_ops *);extern struct ts_config *textsearch_prepare (const char *,const void *, -unsigned int ,int ,int ); +unsigned int ,gfp_t ,int );extern void textsearch_destroy (struct ts_config *conf); extern unsigned int textsearch_find_continuous(struct ts_config *, struct ts_state *,
lib/idr.c +1 -1
@@ -72,7 +72,7 @@* If the system is REALLY out of memory this function returns 0, * otherwise 1. */ -int idr_pre_get (struct idr *idp,unsigned gfp_mask) +int idr_pre_get (struct idr *idp,gfp_t gfp_mask) {while (idp->id_free_cnt <IDR_FREE_MAX ) {struct idr_layer *new;
lib/kobject.c +1 -1
@@ -100,7 +100,7 @@* @kobj: kobject in question, with which to build the path * @gfp_mask: the allocation type used to allocate the path */ -char *kobject_get_path (struct kobject *kobj,int gfp_mask) +char *kobject_get_path (struct kobject *kobj,gfp_t gfp_mask) {char *path;int len;
lib/kobject_uevent.c +2 -2
@@ -62,7 +62,7 @@* @gfp_mask: */ static int send_uevent (const char *signal,const char *obj, -char **envp,int gfp_mask) +char **envp,gfp_t gfp_mask) {struct sk_buff *skb;char *pos;
@@ -98,7 +98,7 @@ }static int do_kobject_uevent (struct kobject *kobj,enum kobject_action action, -struct attribute *attr,int gfp_mask) +struct attribute *attr,gfp_t gfp_mask) {char *path;char *attrpath;
lib/textsearch.c +1 -1
@@ -254,7 +254,7 @@* parameters or a ERR_PTR(). */ struct ts_config *textsearch_prepare (const char *algo,const void *pattern, -unsigned int len,int gfp_mask,int flags) +unsigned int len,gfp_t gfp_mask,int flags) {int err = -ENOENT ;struct ts_config *conf;
RFC 1/1 gfp flags annotations - part 5 (net/*)
In reply to Linus Torvalds missing gfp_t in net/* and around
----
include/linux/security.h +1 -1
@@ -1210,7 +1210,7 @@int (*socket_shutdown) (struct socket * sock,int how);int (*socket_sock_rcv_skb) (struct sock * sk,struct sk_buff * skb);int (*socket_getpeersec) (struct socket *sock,char __user *optval,int __user *optlen,unsigned len); -int (*sk_alloc_security) (struct sock *sk,int family,int priority); +int (*sk_alloc_security) (struct sock *sk,int family,gfp_t priority);void (*sk_free_security) (struct sock *sk);#endif /* CONFIG_SECURITY_NETWORK */ };
include/net/sock.h +1 -1
@@ -207,7 +207,7 @@struct sk_buff_head sk_write_queue;int sk_wmem_queued;int sk_forward_alloc; -unsigned int sk_allocation; +gfp_t sk_allocation;int sk_sndbuf;int sk_route_caps;unsigned long sk_flags;
net/core/sock.c +1 -1
@@ -940,7 +940,7 @@ int noblock, int *errcode) { struct sk_buff *skb; -unsigned int gfp_mask; +gfp_t gfp_mask;long timeo;int err;
net/dccp/output.c +1 -1
@@ -495,7 +495,7 @@ {struct dccp_sock *dp =dccp_sk (sk);struct sk_buff *skb; -const unsigned int prio = active ?GFP_KERNEL :GFP_ATOMIC ; +const gfp_t prio = active ?GFP_KERNEL :GFP_ATOMIC ; skb =alloc_skb (sk->sk_prot->max_header, prio);if (skb ==NULL )
net/netlink/af_netlink.c +1 -1
@@ -827,7 +827,7 @@int failure;int congested;int delivered; -unsigned int allocation; +gfp_t allocation;struct sk_buff *skb, *skb2; };
security/dummy.c +1 -1
@@ -768,7 +768,7 @@return -ENOPROTOOPT ; } -static inline int dummy_sk_alloc_security (struct sock *sk,int family,int priority) +static inline int dummy_sk_alloc_security (struct sock *sk,int family,gfp_t priority) {return 0 ; }
security/selinux/hooks.c +2 -2
@@ -262,7 +262,7 @@ }#ifdef CONFIG_SECURITY_NETWORK -static int sk_alloc_security (struct sock *sk,int family,int priority) +static int sk_alloc_security (struct sock *sk,int family,gfp_t priority) {struct sk_security_struct *ssec;
@@ -3380,7 +3380,7 @@return err; } -static int selinux_sk_alloc_security (struct sock *sk,int family,int priority) +static int selinux_sk_alloc_security (struct sock *sk,int family,gfp_t priority) {return sk_alloc_security (sk, family, priority); }
RFC 1/1 gfp flags annotations - part 6 (simple parts of fs/*)
In reply to Linus Torvalds - ->releasepage() annotated (s/int/gfp_t), instances updated
- missing gfp_t in fs/* added
- fixed misannotation from the first part caught by bitwise checks -
XFS used __nocast both for gfp_t and for flags used by XFS allocator. The latter left with unsigned int __nocast; we might want to add a different type for those but for now let's leave them alone. That, BTW, is a case when __nocast use had been actively confusing - it had been used in the same code for two different and similar types, with no way to catch misuses. Switch of gfp_t to bitwise had caught that immediately...
One tricky bit is left alone to be dealt with later - mapping->flags
is a mix of gfp_t and error indications. Left alone for now.
A bug had been caught in relayfs code -
mem = vmap(buf->page_array, n_pages, GFP_KERNEL, PAGE_KERNEL);in fs/relayfs/buffers.c is bogus (the third argument of vmap() is unrelated to gfp flags). s/GFP_KERNEL/VM_MAP/, presumably? Author Cc'd, code in question left alone for now.
----
fs/afs/file.c +2 -2
@@ -29,7 +29,7 @@static int afs_file_readpage (struct file *file,struct page *page);static int afs_file_invalidatepage (struct page *page,unsigned long offset); -static int afs_file_releasepage (struct page *page,int gfp_flags); +static int afs_file_releasepage (struct page *page,gfp_t gfp_flags);static ssize_t afs_file_write (struct file *file,const char __user *buf,size_t size,loff_t *off);
@@ -279,7 +279,7 @@/* * release a page and cleanup its private data */ -static int afs_file_releasepage (struct page *page,int gfp_flags) +static int afs_file_releasepage (struct page *page,gfp_t gfp_flags) {struct cachefs_page *pageio;
fs/bio.c +2 -2
@@ -778,7 +778,7 @@static struct bio *__bio_map_kern (request_queue_t *q,void *data, -unsigned int len,unsigned int gfp_mask) +unsigned int len,gfp_t gfp_mask) {unsigned long kaddr = (unsigned long )data;unsigned long end = (kaddr + len +PAGE_SIZE -1 ) >>PAGE_SHIFT ;
@@ -825,7 +825,7 @@* device. Returns an error pointer in case of error. */ struct bio *bio_map_kern (request_queue_t *q,void *data,unsigned int len, -unsigned int gfp_mask) +gfp_t gfp_mask) {struct bio *bio;
fs/buffer.c +1 -1
@@ -1571,7 +1571,7 @@* * NOTE: @gfp_mask may go away, and this function may become non-blocking. */ -int try_to_release_page (struct page *page,int gfp_mask) +int try_to_release_page (struct page *page,gfp_t gfp_mask) {struct address_space *const mapping = page->mapping;
fs/dcache.c +1 -1
@@ -689,7 +689,7 @@* * In this case we return -1 to tell the caller that we baled. */ -static int shrink_dcache_memory (int nr,unsigned int gfp_mask) +static int shrink_dcache_memory (int nr,gfp_t gfp_mask) {if (nr) {if (!(gfp_mask & __GFP_FS))
fs/dquot.c +1 -1
@@ -500,7 +500,7 @@* more memory */ -static int shrink_dqcache_memory (int nr,unsigned int gfp_mask) +static int shrink_dqcache_memory (int nr,gfp_t gfp_mask) {if (nr) {spin_lock (&dq_list_lock);
fs/ext3/inode.c +1 -1
@@ -1434,7 +1434,7 @@return journal_invalidatepage (journal, page, offset); } -static int ext3_releasepage (struct page *page,int wait) +static int ext3_releasepage (struct page *page,gfp_t wait) {journal_t *journal =EXT3_JOURNAL (page->mapping->host);
fs/hfs/inode.c +1 -1
@@ -46,7 +46,7 @@return generic_block_bmap (mapping, block, hfs_get_block); } -static int hfs_releasepage (struct page *page,int mask) +static int hfs_releasepage (struct page *page,gfp_t mask) {struct inode *inode = page->mapping->host;struct super_block *sb = inode->i_sb;
fs/hfsplus/inode.c +1 -1
@@ -40,7 +40,7 @@return generic_block_bmap (mapping, block, hfsplus_get_block); } -static int hfsplus_releasepage (struct page *page,int mask) +static int hfsplus_releasepage (struct page *page,gfp_t mask) {struct inode *inode = page->mapping->host;struct super_block *sb = inode->i_sb;
fs/inode.c +1 -1
@@ -475,7 +475,7 @@* This function is passed the number of inodes to scan, and it returns the * total number of remaining possibly-reclaimable inodes. */ -static int shrink_icache_memory (int nr,unsigned int gfp_mask) +static int shrink_icache_memory (int nr,gfp_t gfp_mask) {if (nr) {/*
fs/jbd/journal.c +1 -1
@@ -1606,7 +1606,7 @@* Simple support for retrying memory allocations. Introduced to help to * debug different VM deadlock avoidance strategies. */ -void *__jbd_kmalloc (const char *where,size_t size,int flags,int retry) +void *__jbd_kmalloc (const char *where,size_t size,gfp_t flags,int retry) {return kmalloc (size, flags | (retry ? __GFP_NOFAIL :0 )); }
fs/jbd/transaction.c +1 -1
@@ -1621,7 +1621,7 @@* while the data is part of a transaction. Yes? */ int journal_try_to_free_buffers (journal_t *journal, -struct page *page,int unused_gfp_mask) +struct page *page,gfp_t unused_gfp_mask) {struct buffer_head *head;struct buffer_head *bh;
fs/jfs/jfs_metapage.c +2 -2
@@ -198,7 +198,7 @@ } } -static inline struct metapage *alloc_metapage (unsigned int gfp_mask) +static inline struct metapage *alloc_metapage (gfp_t gfp_mask) {return mempool_alloc (metapage_mempool, gfp_mask); }
@@ -534,7 +534,7 @@return -EIO ; } -static int metapage_releasepage (struct page *page,int gfp_mask) +static int metapage_releasepage (struct page *page,gfp_t gfp_mask) {struct metapage *mp;int busy =0 ;
fs/mbcache.c +3 -3
@@ -116,7 +116,7 @@* What the mbcache registers as to get shrunk dynamically. */ -static int mb_cache_shrink_fn (int nr_to_scan,unsigned int gfp_mask); +static int mb_cache_shrink_fn (int nr_to_scan,gfp_t gfp_mask); static inline int
@@ -140,7 +140,7 @@static inline void -__mb_cache_entry_forget (struct mb_cache_entry *ce,int gfp_mask) +__mb_cache_entry_forget (struct mb_cache_entry *ce,gfp_t gfp_mask) {struct mb_cache *cache = ce->e_cache;
@@ -193,7 +193,7 @@* Returns the number of objects which are present in the cache. */ static int -mb_cache_shrink_fn (int nr_to_scan,unsigned int gfp_mask) +mb_cache_shrink_fn (int nr_to_scan,gfp_t gfp_mask) {LIST_HEAD (free_list);struct list_head *l, *ltmp;
fs/reiserfs/fix_node.c +1 -1
@@ -2022,7 +2022,7 @@ }#ifdef CONFIG_REISERFS_CHECK -void *reiserfs_kmalloc (size_t size,int flags,struct super_block *s) +void *reiserfs_kmalloc (size_t size,gfp_t flags,struct super_block *s) {void *vp;static size_t malloced;
fs/reiserfs/inode.c +1 -1
@@ -2842,7 +2842,7 @@* even in -o notail mode, we can't be sure an old mount without -o notail * didn't create files with tails. */ -static int reiserfs_releasepage (struct page *page,int unused_gfp_flags) +static int reiserfs_releasepage (struct page *page,gfp_t unused_gfp_flags) {struct inode *inode = page->mapping->host;struct reiserfs_journal *j =SB_JOURNAL (inode->i_sb);
fs/xfs/linux-2.6/kmem.c +11 -11
@@ -45,11 +45,11 @@void * -kmem_alloc (size_t size,gfp_t flags) +kmem_alloc (size_t size,unsigned int __nocast flags) { -int retries =0 ; -unsigned int lflags =kmem_flags_convert (flags); -void *ptr; +int retries =0 ; +gfp_t lflags =kmem_flags_convert (flags); +void *ptr; do { if (size < MAX_SLAB_SIZE || retries > MAX_VMALLOCS)
@@ -67,7 +67,7 @@ }void * -kmem_zalloc (size_t size,gfp_t flags) +kmem_zalloc (size_t size,unsigned int __nocast flags) {void *ptr;
@@ -90,7 +90,7 @@void *kmem_realloc (void *ptr,size_t newsize,size_t oldsize, -gfp_t flags) +unsigned int __nocast flags) {void *new;
@@ -105,11 +105,11 @@ }void * -kmem_zone_alloc (kmem_zone_t *zone,gfp_t flags) +kmem_zone_alloc (kmem_zone_t *zone,unsigned int __nocast flags) { -int retries =0 ; -unsigned int lflags =kmem_flags_convert (flags); -void *ptr; +int retries =0 ; +gfp_t lflags =kmem_flags_convert (flags); +void *ptr; do { ptr = kmem_cache_alloc(zone, lflags);
@@ -124,7 +124,7 @@ }void * -kmem_zone_zalloc (kmem_zone_t *zone,gfp_t flags) +kmem_zone_zalloc (kmem_zone_t *zone,unsigned int __nocast flags) {void *ptr;
fs/xfs/linux-2.6/kmem.h +9 -9
@@ -81,9 +81,9 @@ *(NSTATEP ) = *(OSTATEP ); \ }while (0 ) -static __inline unsigned int kmem_flags_convert(gfp_t flags) +static __inline gfp_t kmem_flags_convert(unsigned int __nocast flags) { -unsigned int lflags = __GFP_NOWARN;/* we'll report problems, if need be */ +gfp_t lflags = __GFP_NOWARN;/* we'll report problems, if need be */ #ifdef DEBUG if (unlikely (flags & ~(KM_SLEEP |KM_NOSLEEP |KM_NOFS |KM_MAYFAIL ))) {
@@ -125,16 +125,16 @@BUG (); } -extern void *kmem_zone_zalloc (kmem_zone_t *,gfp_t ); -extern void *kmem_zone_alloc (kmem_zone_t *,gfp_t ); +extern void *kmem_zone_zalloc (kmem_zone_t *,unsigned int __nocast ); +extern void *kmem_zone_alloc (kmem_zone_t *,unsigned int __nocast ); -extern void *kmem_alloc (size_t ,gfp_t ); -extern void *kmem_realloc (void *,size_t ,size_t ,gfp_t ); -extern void *kmem_zalloc (size_t ,gfp_t ); +extern void *kmem_alloc (size_t ,unsigned int __nocast ); +extern void *kmem_realloc (void *,size_t ,size_t ,unsigned int __nocast ); +extern void *kmem_zalloc (size_t ,unsigned int __nocast );extern void kmem_free (void *,size_t );typedef struct shrinker *kmem_shaker_t ; -typedef int (*kmem_shake_func_t )(int ,unsigned int ); +typedef int (*kmem_shake_func_t )(int ,gfp_t );static __inlinekmem_shaker_t kmem_shake_register (kmem_shake_func_t sfunc)
@@ -149,7 +149,7 @@ }static __inlineint -kmem_shake_allow (unsigned int gfp_mask) +kmem_shake_allow (gfp_t gfp_mask) {return (gfp_mask & __GFP_WAIT); }
fs/xfs/linux-2.6/xfs_aops.c +1 -1
@@ -1296,7 +1296,7 @@ STATIC intlinvfs_release_page (struct page *page, -int gfp_mask) +gfp_t gfp_mask) {struct inode *inode = page->mapping->host;int dirty, delalloc, unmapped, unwritten;
fs/xfs/linux-2.6/xfs_buf.c +4 -4
@@ -64,7 +64,7 @@ STATIC kmem_cache_t *pagebuf_zone; STATIC kmem_shaker_t pagebuf_shake; -STATIC int xfsbufd_wakeup(int, unsigned int); +STATIC int xfsbufd_wakeup(int, gfp_t); STATIC void pagebuf_delwri_queue(xfs_buf_t *, int); STATIC struct workqueue_struct *xfslogd_workqueue;
@@ -383,7 +383,7 @@size_t blocksize = bp->pb_target->pbr_bsize;size_t size = bp->pb_count_desired;size_t nbytes, offset; -int gfp_mask =pb_to_gfp (flags); +gfp_t gfp_mask =pb_to_gfp (flags);unsigned short page_count, i;pgoff_t first;loff_t end;
@@ -1749,8 +1749,8 @@ STATIC intxfsbufd_wakeup ( -int priority, -unsigned int mask) +int priority, +gfp_t mask) {if (xfsbufd_force_sleep)return 0 ;
include/linux/bio.h +1 -1
@@ -301,7 +301,7 @@ struct sg_iovec *, int, int);extern void bio_unmap_user (struct bio *);extern struct bio *bio_map_kern (struct request_queue *,void *,unsigned int , -unsigned int ); +gfp_t );extern void bio_set_pages_dirty (struct bio *bio);extern void bio_check_pages_dirty (struct bio *bio);extern struct bio *bio_copy_user (struct request_queue *,unsigned long ,unsigned int ,int );
include/linux/buffer_head.h +1 -1
@@ -188,7 +188,7 @@* Generic address_space_operations implementations for buffer_head-backed * address_spaces. */ -int try_to_release_page (struct page * page,int gfp_mask); +int try_to_release_page (struct page * page,gfp_t gfp_mask);int block_invalidatepage (struct page *page,unsigned long offset);int block_write_full_page (struct page *page,get_block_t *get_block,struct writeback_control *wbc);
include/linux/fs.h +1 -1
@@ -320,7 +320,7 @@/* Unfortunately this kludge is needed for FIBMAP. Don't use it */ sector_t (*bmap)(struct address_space *,sector_t );int (*invalidatepage) (struct page *,unsigned long ); -int (*releasepage) (struct page *,int ); +int (*releasepage) (struct page *,gfp_t );ssize_t (*direct_IO)(int ,struct kiocb *,const struct iovec *iov,loff_t offset,unsigned long nr_segs); struct page* (*get_xip_page)(struct address_space *, sector_t,
include/linux/jbd.h +2 -2
@@ -69,7 +69,7 @@ #define jbd_debug(f, a...) /**/#endif -extern void *__jbd_kmalloc (const char *where,size_t size,int flags,int retry); +extern void *__jbd_kmalloc (const char *where,size_t size,gfp_t flags,int retry);#define jbd_kmalloc (size, flags) \ __jbd_kmalloc(__FUNCTION__, (size), (flags), journal_oom_retry)#define jbd_rep_kmalloc (size, flags) \
@@ -890,7 +890,7 @@extern void journal_sync_buffer (struct buffer_head *);extern int journal_invalidatepage (journal_t *,struct page *,unsigned long ); -extern int journal_try_to_free_buffers (journal_t *,struct page *,int ); +extern int journal_try_to_free_buffers (journal_t *,struct page *,gfp_t );extern int journal_stop (handle_t *);extern int journal_flush (journal_t *);extern void journal_lock_updates (journal_t *);
include/linux/mbcache.h +1 -1
@@ -22,7 +22,7 @@ };struct mb_cache_op { -int (*free)(struct mb_cache_entry *,int ); +int (*free)(struct mb_cache_entry *,gfp_t ); };/* Functions on caches */
include/linux/reiserfs_fs.h +1 -1
@@ -1972,7 +1972,7 @@/* fix_nodes.c */ #ifdef CONFIG_REISERFS_CHECK -void *reiserfs_kmalloc (size_t size,int flags,struct super_block *s); +void *reiserfs_kmalloc (size_t size,gfp_t flags,struct super_block *s);void reiserfs_kfree (const void *vp,size_t size,struct super_block *s);#else static inline void *reiserfs_kmalloc(size_t size, int flags,
Re: [RFC] gfp flags annotations - part 6 (simple parts of fs/*)
Quoted 6 lines · Al Viro
A bug had been caught in relayfs code - mem = vmap(buf->page_array, n_pages, GFP_KERNEL, PAGE_KERNEL);in
fs/relayfs/buffers.cis bogus (the third argument ofvmap()is unrelated to gfp flags). s/GFP_KERNEL/VM_MAP/, presumably? Author Cc'd, code in question left alone for now.
Yes, looks like a stupid typo that luckily wasn't affecting the outcome because the GFP_KERNEL value happens to not cause any false test outcomes in the vmap code. I'll submit a patch momentarily.
Thanks for catching this.
Tom
RFC 1/1 gfp flags annotations - part 7 (block layer)
In reply to Linus Torvalds missing gfp_t in block layer (ll_rw_blk, elevator and friends).
Individual drivers left alone for now.
----
[That's it for tonight; the next chunk (dma-mapping) is trickier and even if we want it before 2.6.14, I'd rather give it another look before posting and after I get some sleep. The messy part is in arch/* code - changing prototypes in include/asm-* has to go with corresponding changes in actual definitions of functions in question and tracking down the related forest of defines to make sure that nothing is missed...]
drivers/block/as-iosched.c +1 -1
@@ -1807,7 +1807,7 @@ }static int as_set_request (request_queue_t *q,struct request *rq, -struct bio *bio,int gfp_mask) +struct bio *bio,gfp_t gfp_mask) {struct as_data *ad = q->elevator->elevator_data;struct as_rq *arq =mempool_alloc (ad->arq_pool, gfp_mask);
drivers/block/cfq-iosched.c +4 -4
@@ -1422,7 +1422,7 @@ }static struct cfq_io_context * -cfq_alloc_io_context (struct cfq_data *cfqd,int gfp_mask) +cfq_alloc_io_context (struct cfq_data *cfqd,gfp_t gfp_mask) {struct cfq_io_context *cic =kmem_cache_alloc (cfq_ioc_pool, gfp_mask);
@@ -1517,7 +1517,7 @@static struct cfq_queue *cfq_get_queue (struct cfq_data *cfqd,unsigned int key,unsigned short ioprio, -int gfp_mask) +gfp_t gfp_mask) {const int hashval =hash_long (key,CFQ_QHASH_SHIFT );struct cfq_queue *cfqq, *new_cfqq =NULL ;
@@ -1578,7 +1578,7 @@* cfqq, so we don't need to worry about it disappearing */ static struct cfq_io_context * -cfq_get_io_context (struct cfq_data *cfqd,pid_t pid,int gfp_mask) +cfq_get_io_context (struct cfq_data *cfqd,pid_t pid,gfp_t gfp_mask) {struct io_context *ioc =NULL ;struct cfq_io_context *cic;
@@ -2075,7 +2075,7 @@*/ static int cfq_set_request (request_queue_t *q,struct request *rq,struct bio *bio, -int gfp_mask) +gfp_t gfp_mask) {struct cfq_data *cfqd = q->elevator->elevator_data;struct task_struct *tsk = current;
drivers/block/deadline-iosched.c +1 -1
@@ -756,7 +756,7 @@static int deadline_set_request (request_queue_t *q,struct request *rq,struct bio *bio, -int gfp_mask) +gfp_t gfp_mask) {struct deadline_data *dd = q->elevator->elevator_data;struct deadline_rq *drq;
drivers/block/elevator.c +1 -1
@@ -487,7 +487,7 @@ }int elv_set_request (request_queue_t *q,struct request *rq,struct bio *bio, -int gfp_mask) +gfp_t gfp_mask) {elevator_t *e = q->elevator;
drivers/block/ll_rw_blk.c +8 -8
@@ -1652,13 +1652,13 @@static int __make_request (request_queue_t *,struct bio *); -request_queue_t *blk_alloc_queue (int gfp_mask) +request_queue_t *blk_alloc_queue (gfp_t gfp_mask) {return blk_alloc_queue_node (gfp_mask,-1 ); }EXPORT_SYMBOL (blk_alloc_queue); -request_queue_t *blk_alloc_queue_node (int gfp_mask,int node_id) +request_queue_t *blk_alloc_queue_node (gfp_t gfp_mask,int node_id) {request_queue_t *q;
@@ -1787,7 +1787,7 @@ }static inline struct request * -blk_alloc_request (request_queue_t *q,int rw,struct bio *bio,int gfp_mask) +blk_alloc_request (request_queue_t *q,int rw,struct bio *bio,gfp_t gfp_mask) {struct request *rq =mempool_alloc (q->rq.rq_pool, gfp_mask);
@@ -1885,7 +1885,7 @@* Returns !NULL on success, with queue_lock *not held*. */ static struct request *get_request (request_queue_t *q,int rw,struct bio *bio, -int gfp_mask) +gfp_t gfp_mask) {struct request *rq =NULL ;struct request_list *rl = &q->rq;
@@ -2019,7 +2019,7 @@return rq; } -struct request *blk_get_request (request_queue_t *q,int rw,int gfp_mask) +struct request *blk_get_request (request_queue_t *q,int rw,gfp_t gfp_mask) {struct request *rq;
@@ -2251,7 +2251,7 @@* @gfp_mask: memory allocation flags */ int blk_rq_map_kern (request_queue_t *q,struct request *rq,void *kbuf, -unsigned int len,unsigned int gfp_mask) +unsigned int len,gfp_t gfp_mask) {struct bio *bio;
@@ -3393,7 +3393,7 @@* but since the current task itself holds a reference, the context can be * used in general code, so long as it stays within `current` context. */ -struct io_context *current_io_context (int gfp_flags) +struct io_context *current_io_context (gfp_t gfp_flags) {struct task_struct *tsk = current;struct io_context *ret;
@@ -3424,7 +3424,7 @@* * This is always called in the context of the task which submitted the I/O. */ -struct io_context *get_io_context (int gfp_flags) +struct io_context *get_io_context (gfp_t gfp_flags) {struct io_context *ret; ret =current_io_context (gfp_flags);
include/linux/blkdev.h +7 -7
@@ -96,8 +96,8 @@void put_io_context (struct io_context *ioc);void exit_io_context (void ); -struct io_context *current_io_context (int gfp_flags); -struct io_context *get_io_context (int gfp_flags); +struct io_context *current_io_context (gfp_t gfp_flags); +struct io_context *get_io_context (gfp_t gfp_flags);void copy_io_context (struct io_context **pdst,struct io_context **psrc);void swap_io_context (struct io_context **ioc1,struct io_context **ioc2);
@@ -354,7 +354,7 @@* queue needs bounce pages for pages above this limit */ unsigned long bounce_pfn; -unsigned int bounce_gfp; +gfp_t bounce_gfp;/* * various queue flags, see QUEUE_* below
@@ -550,7 +550,7 @@extern void blk_put_request (struct request *);extern void blk_end_sync_rq (struct request *rq);extern void blk_attempt_remerge (request_queue_t *,struct request *); -extern struct request *blk_get_request (request_queue_t *,int ,int ); +extern struct request *blk_get_request (request_queue_t *,int ,gfp_t );extern void blk_insert_request (request_queue_t *,struct request *,int ,void *);extern void blk_requeue_request (request_queue_t *,struct request *);extern void blk_plug_device (request_queue_t *);
@@ -565,7 +565,7 @@extern void blk_queue_activity_fn (request_queue_t *,activity_fn *,void *);extern int blk_rq_map_user (request_queue_t *,struct request *,void __user *,unsigned int );extern int blk_rq_unmap_user (struct bio *,unsigned int ); -extern int blk_rq_map_kern (request_queue_t *,struct request *,void *,unsigned int ,unsigned int ); +extern int blk_rq_map_kern (request_queue_t *,struct request *,void *,unsigned int ,gfp_t );extern int blk_rq_map_user_iov (request_queue_t *,struct request *,struct sg_iovec *,int );extern int blk_execute_rq (request_queue_t *,struct gendisk *,struct request *,int );
@@ -654,8 +654,8 @@extern void blk_finish_queue_drain (request_queue_t *);int blk_get_queue (request_queue_t *); -request_queue_t *blk_alloc_queue (int gfp_mask); -request_queue_t *blk_alloc_queue_node (int ,int ); +request_queue_t *blk_alloc_queue (gfp_t ); +request_queue_t *blk_alloc_queue_node (gfp_t ,int );#define blk_put_queue (q) blk_cleanup_queue((q))/*
include/linux/elevator.h +2 -2
@@ -18,7 +18,7 @@typedef void (elevator_completed_req_fn ) (request_queue_t *,struct request *);typedef int (elevator_may_queue_fn ) (request_queue_t *,int ,struct bio *); -typedef int (elevator_set_req_fn ) (request_queue_t *,struct request *,struct bio *,int ); +typedef int (elevator_set_req_fn ) (request_queue_t *,struct request *,struct bio *,gfp_t );typedef void (elevator_put_req_fn ) (request_queue_t *,struct request *);typedef void (elevator_deactivate_req_fn ) (request_queue_t *,struct request *);
@@ -98,7 +98,7 @@extern void elv_unregister_queue (request_queue_t *q);extern int elv_may_queue (request_queue_t *,int ,struct bio *);extern void elv_completed_request (request_queue_t *,struct request *); -extern int elv_set_request (request_queue_t *,struct request *,struct bio *,int ); +extern int elv_set_request (request_queue_t *,struct request *,struct bio *,gfp_t );extern void elv_put_request (request_queue_t *,struct request *);/*
PATCH 1/1 n_r3964: drop bogus fmt casts
In reply to Al Viro* print pointers with %p
* casting unsigned int structure field to int and printing it with %d...
---
drivers/char/n_r3964.c | 84 ++++++++++++++++++++++++------------------------- 1 files changed, 42 insertions(+), 42 deletions(-)
drivers/char/n_r3964.c +42 -42
@@ -229,8 +229,8 @@ static int __init r3964_init(void)TRACE_L ("line discipline %d registered" ,N_R3964 );TRACE_L ("flags=%x num=%x" , tty_ldisc_N_R3964.flags, tty_ldisc_N_R3964.num); -TRACE_L ("open=%x" , (int )tty_ldisc_N_R3964.open); -TRACE_L ("tty_ldisc_N_R3964 = %x" , (int )&tty_ldisc_N_R3964); +TRACE_L ("open=%p" , tty_ldisc_N_R3964.open); +TRACE_L ("tty_ldisc_N_R3964 = %p" , &tty_ldisc_N_R3964); }else {
@@ -267,8 +267,8 @@ static void add_tx_queue(struct r3964_inspin_unlock_irqrestore (&pInfo->lock, flags); -TRACE_Q ("add_tx_queue %x, length %d, tx_first = %x" , - (int )pHeader, pHeader->length, (int )pInfo->tx_first ); +TRACE_Q ("add_tx_queue %p, length %d, tx_first = %p" , + pHeader, pHeader->length, pInfo->tx_first ); }static void remove_from_tx_queue (struct r3964_info *pInfo,int error_code)
@@ -285,10 +285,10 @@ static void remove_from_tx_queue(structreturn ;#ifdef DEBUG_QUEUE -printk ("r3964: remove_from_tx_queue: %x, length %d - " , - (int )pHeader, (int )pHeader->length ); +printk ("r3964: remove_from_tx_queue: %p, length %u - " , + pHeader, pHeader->length );for (pDump=pHeader;pDump;pDump=pDump->next) -printk ("%x " , (int )pDump); +printk ("%p " , pDump);printk ("\n" );#endif
@@ -319,10 +319,10 @@ static void remove_from_tx_queue(structspin_unlock_irqrestore (&pInfo->lock, flags);kfree (pHeader); -TRACE_M ("remove_from_tx_queue - kfree %x" ,(int )pHeader); +TRACE_M ("remove_from_tx_queue - kfree %p" ,pHeader); -TRACE_Q ("remove_from_tx_queue: tx_first = %x, tx_last = %x" , - (int )pInfo->tx_first, (int )pInfo->tx_last ); +TRACE_Q ("remove_from_tx_queue: tx_first = %p, tx_last = %p" , + pInfo->tx_first, pInfo->tx_last ); }static void add_rx_queue (struct r3964_info *pInfo,struct r3964_block_header *pHeader)
@@ -346,9 +346,9 @@ static void add_rx_queue(struct r3964_inspin_unlock_irqrestore (&pInfo->lock, flags); -TRACE_Q ("add_rx_queue: %x, length = %d, rx_first = %x, count = %d" , - (int )pHeader, pHeader->length, - (int )pInfo->rx_first, pInfo->blocks_in_rx_queue); +TRACE_Q ("add_rx_queue: %p, length = %d, rx_first = %p, count = %d" , + pHeader, pHeader->length, + pInfo->rx_first, pInfo->blocks_in_rx_queue); } static void remove_from_rx_queue(struct r3964_info *pInfo,
@@ -360,10 +360,10 @@ static void remove_from_rx_queue(structif (pHeader==NULL )return ; -TRACE_Q ("remove_from_rx_queue: rx_first = %x, rx_last = %x, count = %d" , - (int )pInfo->rx_first, (int )pInfo->rx_last, pInfo->blocks_in_rx_queue ); -TRACE_Q ("remove_from_rx_queue: %x, length %d" , - (int )pHeader, (int )pHeader->length ); +TRACE_Q ("remove_from_rx_queue: rx_first = %p, rx_last = %p, count = %d" , + pInfo->rx_first, pInfo->rx_last, pInfo->blocks_in_rx_queue ); +TRACE_Q ("remove_from_rx_queue: %p, length %u" , + pHeader, pHeader->length );spin_lock_irqsave (&pInfo->lock, flags);
@@ -401,10 +401,10 @@ static void remove_from_rx_queue(structspin_unlock_irqrestore (&pInfo->lock, flags);kfree (pHeader); -TRACE_M ("remove_from_rx_queue - kfree %x" ,(int )pHeader); +TRACE_M ("remove_from_rx_queue - kfree %p" ,pHeader); -TRACE_Q ("remove_from_rx_queue: rx_first = %x, rx_last = %x, count = %d" , - (int )pInfo->rx_first, (int )pInfo->rx_last, pInfo->blocks_in_rx_queue ); +TRACE_Q ("remove_from_rx_queue: rx_first = %p, rx_last = %p, count = %d" , + pInfo->rx_first, pInfo->rx_last, pInfo->blocks_in_rx_queue ); }static void put_char (struct r3964_info *pInfo,unsigned char ch)
@@ -506,8 +506,8 @@ static void transmit_block(struct r3964_if (tty->driver->write_room) room=tty->driver->write_room (tty); -TRACE_PS ("transmit_block %x, room %d, length %d" , - (int )pBlock, room, pBlock->length); +TRACE_PS ("transmit_block %p, room %d, length %d" , + pBlock, room, pBlock->length);while (pInfo->tx_position < pBlock->length) {
@@ -588,7 +588,7 @@ static void on_receive_block(struct r396/* prepare struct r3964_block_header: */ pBlock =kmalloc (length+sizeof (struct r3964_block_header ),GFP_KERNEL ); -TRACE_M ("on_receive_block - kmalloc %x" ,(int )pBlock); +TRACE_M ("on_receive_block - kmalloc %p" ,pBlock);if (pBlock==NULL )return ;
@@ -868,11 +868,11 @@ static int enable_signals(struct r3964_iif (pMsg) {kfree (pMsg); -TRACE_M ("enable_signals - msg kfree %x" ,(int )pMsg); +TRACE_M ("enable_signals - msg kfree %p" ,pMsg); } }kfree (pClient); -TRACE_M ("enable_signals - kfree %x" ,(int )pClient); +TRACE_M ("enable_signals - kfree %p" ,pClient);return 0 ; } }
@@ -890,7 +890,7 @@ static int enable_signals(struct r3964_i {/* add client to client list */ pClient=kmalloc (sizeof (struct r3964_client_info ),GFP_KERNEL ); -TRACE_M ("enable_signals - kmalloc %x" ,(int )pClient); +TRACE_M ("enable_signals - kmalloc %p" ,pClient);if (pClient==NULL )return -ENOMEM ;
@@ -954,7 +954,7 @@ static void add_msg(struct r3964_client_ queue_the_message: pMsg =kmalloc (sizeof (struct r3964_message ),GFP_KERNEL ); -TRACE_M ("add_msg - kmalloc %x" ,(int )pMsg); +TRACE_M ("add_msg - kmalloc %p" ,pMsg);if (pMsg==NULL ) {return ; }
@@ -1067,11 +1067,11 @@ static int r3964_open(struct tty_structstruct r3964_info *pInfo;TRACE_L ("open" ); -TRACE_L ("tty=%x, PID=%d, disc_data=%x" , - (int )tty, current->pid, (int )tty->disc_data); +TRACE_L ("tty=%p, PID=%d, disc_data=%p" , + tty, current->pid, tty->disc_data); pInfo=kmalloc (sizeof (struct r3964_info ),GFP_KERNEL ); -TRACE_M ("r3964_open - info kmalloc %x" ,(int )pInfo); +TRACE_M ("r3964_open - info kmalloc %p" ,pInfo);if (!pInfo) {
@@ -1080,26 +1080,26 @@ static int r3964_open(struct tty_struct } pInfo->rx_buf =kmalloc (RX_BUF_SIZE ,GFP_KERNEL ); -TRACE_M ("r3964_open - rx_buf kmalloc %x" ,(int )pInfo->rx_buf); +TRACE_M ("r3964_open - rx_buf kmalloc %p" ,pInfo->rx_buf);if (!pInfo->rx_buf) {printk (KERN_ERR "r3964: failed to alloc receive buffer\n" );kfree (pInfo); -TRACE_M ("r3964_open - info kfree %x" ,(int )pInfo); +TRACE_M ("r3964_open - info kfree %p" ,pInfo);return -ENOMEM ; } pInfo->tx_buf =kmalloc (TX_BUF_SIZE ,GFP_KERNEL ); -TRACE_M ("r3964_open - tx_buf kmalloc %x" ,(int )pInfo->tx_buf); +TRACE_M ("r3964_open - tx_buf kmalloc %p" ,pInfo->tx_buf);if (!pInfo->tx_buf) {printk (KERN_ERR "r3964: failed to alloc transmit buffer\n" );kfree (pInfo->rx_buf); -TRACE_M ("r3964_open - rx_buf kfree %x" ,(int )pInfo->rx_buf); +TRACE_M ("r3964_open - rx_buf kfree %p" ,pInfo->rx_buf);kfree (pInfo); -TRACE_M ("r3964_open - info kfree %x" ,(int )pInfo); +TRACE_M ("r3964_open - info kfree %p" ,pInfo);return -ENOMEM ; }
@@ -1154,11 +1154,11 @@ static void r3964_close(struct tty_strucif (pMsg) {kfree (pMsg); -TRACE_M ("r3964_close - msg kfree %x" ,(int )pMsg); +TRACE_M ("r3964_close - msg kfree %p" ,pMsg); } }kfree (pClient); -TRACE_M ("r3964_close - client kfree %x" ,(int )pClient); +TRACE_M ("r3964_close - client kfree %p" ,pClient); pClient=pNext; }/* Remove jobs from tx_queue: */
@@ -1177,11 +1177,11 @@ static void r3964_close(struct tty_struc/* Free buffers: */ wake_up_interruptible (&pInfo->read_wait);kfree (pInfo->rx_buf); -TRACE_M ("r3964_close - rx_buf kfree %x" ,(int )pInfo->rx_buf); +TRACE_M ("r3964_close - rx_buf kfree %p" ,pInfo->rx_buf);kfree (pInfo->tx_buf); -TRACE_M ("r3964_close - tx_buf kfree %x" ,(int )pInfo->tx_buf); +TRACE_M ("r3964_close - tx_buf kfree %p" ,pInfo->tx_buf);kfree (pInfo); -TRACE_M ("r3964_close - info kfree %x" ,(int )pInfo); +TRACE_M ("r3964_close - info kfree %p" ,pInfo); } static ssize_t r3964_read(struct tty_struct *tty, struct file *file,
@@ -1234,7 +1234,7 @@ repeat: count =sizeof (struct r3964_client_message );kfree (pMsg); -TRACE_M ("r3964_read - msg kfree %x" ,(int )pMsg); +TRACE_M ("r3964_read - msg kfree %p" ,pMsg);if (copy_to_user (buf,&theMsg, count))return -EFAULT ;
@@ -1279,7 +1279,7 @@ static ssize_t r3964_write(struct tty_st* Allocate a buffer for the data and copy it from the buffer with header prepended */ new_data =kmalloc (count+sizeof (struct r3964_block_header ),GFP_KERNEL ); -TRACE_M ("r3964_write - kmalloc %x" ,(int )new_data); +TRACE_M ("r3964_write - kmalloc %p" ,new_data);if (new_data ==NULL ) {if (pInfo->flags &R3964_DEBUG ) {
Al Viro
maintainerRe: [PATCH] n_r3964: drop bogus fmt casts
Quoted 4 lines · Alexey Dobriyan
* print pointers with %p
* casting unsigned int structure field to int and printing it with %d...Signed-off-by Alexey Dobriyan <[email protected]>
ACK and merged.
[email protected]
maintainerQuoted 10 lines · Alexey Dobriyan
Quoted 8 lines · On Mon, Sep 05, 2005 at 04:58:48AM +0100, [email protected] wrote:
While waaaaay overdue, "fixes and sparse annotations" tree is finally
going public. This version is basically a starting point - there will be much more stuff to merge.Current patchset is on ftp.linux.org.uk/pub/people/viro/ -
patch-2.6.13-git3-bird1.bz2 is combined patch, patchset/* is the splitup. Long description of patches is in patchset/set*, short log is in the end of this posting. Current build and sparse logs are in logs/*/{log17b,S-log17b}.
Quoted 7 lines
Those who want to help with endian annotations (sparse -Wbitwise) are welcome at ftp://ftp.berlios.de/pub/linux-sparse/logs/
[allmodconfig +
CONFIG_DEBUG_INFO=n] x [alpha, i386, parisc, ppc, ppc64, s390, sh, sh64, sparc, sparc64,x86_64]-git5 is compiling right now.
BTW, endianness annotation patches are welcome - that's one of the reasons why that tree had been started.
Speaking of targets, please consider allmodconfig-with-subset ones. On the same anonftp there is a script (kmk) and config for it (kmk.rc). Intended use (with I[0-2]-* patches from the patchset):
kmk <target> <normal make arguments>
in the source tree. It picks cross-toolchain according to target and runs make with appropriate O=...
Toolchain description is picked from ~/kmkrc or /etc/kmk.rc (user and system-wide, resp.). It's a shell script sourced by kmk; it sets two variables (CONFIGDIR - place where target descriptions will be found and BUILDBASE - where we keep the build trees) and describes the available cross-toolchain. See the example on ftp.linux.org.uk - it should be fairly self-explanatory. This one has build trees on ../build/$target and configs in ../config/$target; see config/* on the same anonftp for live example of target descriptions.
Main difference from normal kbuild targets is for allmodconfig - saying kmk $target allmodconfig
will create .config in $BUILDBASE/$target with as much as possible set to y/m while subset mentioned in $CONFIGDIR/$target is kept fixed. Note that you can both set and clear options in target descriptions.
Since kmk ends up calling make, all normal uses are preserved - incrmentals, building individual targets/subdirectories, etc. All kbuild stuff works.
Note that you can pass additional flags to sparse by having CF=<extra flags> in kmk (actually, make) options. So CF=-Wbitwise will do everything you need without mutilating makefiles.
That turns out to be very important for parallel builds for many targets - you really, really want to have them all done on the same source tree. Makes for much faster builds, avoids problems with propagation of patches between the source trees and reduces the disk and cache footprint of the entire thing. Use of -j, OTOH, doesn't buy you anything - it gets worse cache utilization *and* messes the build logs.