2004-06-24 23:45:29

by J.A. Magallon

[permalink] [raw]
Subject: gcc-3.4.1 and -Winline

Hi all...

This are the warnings I get with gcc-3.4.1 CVS, when building 2.6.7-mm2.
Just for if some is really serious, ie, something that does not work if
compiled out-of-line (but I suppose I had noticed ;) ).
Or if it origins a huge performace penalty.

TIA


CC arch/i386/kernel/timers/timer_tsc.o
arch/i386/kernel/timers/timer_tsc.c: In function `mark_offset_tsc':
arch/i386/kernel/timers/timer_tsc.c:30: warning: inlining failed in call to 'cpufreq_delayed_get': function body not available
arch/i386/kernel/timers/timer_tsc.c:248: warning: called from here

CC arch/i386/kernel/smp.o
arch/i386/kernel/smp.c: In function `flush_tlb_others':
arch/i386/kernel/smp.c:161: warning: inlining failed in call to 'send_IPI_mask_bitmask': function not considered for inlining
arch/i386/kernel/smp.c:9: warning: called from here
arch/i386/kernel/smp.c: In function `smp_send_reschedule':
arch/i386/kernel/smp.c:161: warning: inlining failed in call to 'send_IPI_mask_bitmask': function not considered for inlining
arch/i386/kernel/smp.c:9: warning: called from here
arch/i386/kernel/smp.c: In function `smp_call_function':
arch/i386/kernel/smp.c:126: warning: inlining failed in call to '__send_IPI_shortcut': function not considered for inlining
arch/i386/kernel/smp.c:21: warning: called from here

CC arch/i386/kernel/io_apic.o
arch/i386/kernel/io_apic.c: In function `setup_IO_APIC':
arch/i386/kernel/io_apic.c:2110: warning: inlining failed in call to 'check_timer': function not considered for inlining
arch/i386/kernel/io_apic.c:2246: warning: called from here
arch/i386/kernel/io_apic.c: In function `check_timer':
arch/i386/kernel/io_apic.c:2049: warning: inlining failed in call to 'unlock_ExtINT_logic': function not considered for inlining
arch/i386/kernel/io_apic.c:2208: warning: called from here

CC kernel/fork.o
kernel/fork.c: In function `copy_mm':
kernel/fork.c:270: warning: inlining failed in call to 'dup_mmap': function not considered for inlining
kernel/fork.c:571: warning: called from here

CC mm/rmap.o
mm/rmap.c: In function `try_to_unmap':
mm/rmap.c:653: warning: inlining failed in call to 'try_to_unmap_file': function not considered for inlining
mm/rmap.c:774: warning: called from here

CC fs/exec.o
fs/exec.c: In function `flush_old_exec':
fs/exec.c:566: warning: inlining failed in call to 'de_thread': function not considered for inlining
fs/exec.c:800: warning: called from here

CC fs/namei.o
fs/namei.c: In function `link_path_walk':
fs/namei.c:491: warning: inlining failed in call to 'follow_dotdot': function not considered for inlining
fs/namei.c:637: warning: called from here
fs/namei.c:491: warning: inlining failed in call to 'follow_dotdot': function not considered for inlining
fs/namei.c:705: warning: called from here

CC [M] fs/nfsd/nfsxdr.o
fs/nfsd/nfsxdr.c: In function `nfssvc_encode_attrstat':
fs/nfsd/nfsxdr.c:150: warning: inlining failed in call to 'encode_fattr': function not considered for inlining
fs/nfsd/nfsxdr.c:386: warning: called from here
fs/nfsd/nfsxdr.c: In function `nfssvc_encode_diropres':
fs/nfsd/nfsxdr.c:150: warning: inlining failed in call to 'encode_fattr': function not considered for inlining
fs/nfsd/nfsxdr.c:395: warning: called from here
fs/nfsd/nfsxdr.c: In function `nfssvc_encode_readres':
fs/nfsd/nfsxdr.c:150: warning: inlining failed in call to 'encode_fattr': function not considered for inlining
fs/nfsd/nfsxdr.c:420: warning: called from here

CC [M] fs/nfsd/nfs3xdr.o
fs/nfsd/nfs3xdr.c: In function `encode_post_op_attr':
fs/nfsd/nfs3xdr.c:168: warning: inlining failed in call to 'encode_fattr3': function not considered for inlining
fs/nfsd/nfs3xdr.c:246: warning: called from here
fs/nfsd/nfs3xdr.c: In function `encode_wcc_data':
fs/nfsd/nfs3xdr.c:204: warning: inlining failed in call to 'encode_saved_post_attr': function not considered for inlining
fs/nfsd/nfs3xdr.c:269: warning: called from here
fs/nfsd/nfs3xdr.c: In function `nfs3svc_encode_attrstat':
fs/nfsd/nfs3xdr.c:168: warning: inlining failed in call to 'encode_fattr3': function not considered for inlining
fs/nfsd/nfs3xdr.c:618: warning: called from here

CC fs/proc/array.o
fs/proc/array.c: In function `proc_pid_status':
fs/proc/array.c:232: warning: inlining failed in call to 'task_sig': function not considered for inlining
fs/proc/array.c:290: warning: called from here

CC drivers/block/elevator.o
drivers/block/elevator.c: In function `__elv_add_request':
include/linux/blkdev.h:617: warning: inlining failed in call to '__generic_unplug_device': function body not available
drivers/block/elevator.c:189: warning: called from here

CC drivers/char/n_tty.o
drivers/char/n_tty.c: In function `n_tty_receive_buf':
drivers/char/n_tty.c:529: warning: inlining failed in call to 'n_tty_receive_char': function not considered for inlining
drivers/char/n_tty.c:789: warning: called from here

CC drivers/char/vt_ioctl.o
drivers/char/vt_ioctl.c: In function `vt_ioctl':
drivers/char/vt_ioctl.c:187: warning: inlining failed in call to 'do_kdgkb_ioctl': function not considered for inlining
drivers/char/vt_ioctl.c:582: warning: called from here

CC [M] drivers/i2c/algos/i2c-algo-bit.o
drivers/i2c/algos/i2c-algo-bit.c: In function `bit_xfer':
drivers/i2c/algos/i2c-algo-bit.c:366: warning: inlining failed in call to 'readbytes': function not considered for inlining
drivers/i2c/algos/i2c-algo-bit.c:494: warning: called from here

CC [M] drivers/ieee1394/eth1394.o
drivers/ieee1394/eth1394.c: In function `eth1394_remove':
drivers/ieee1394/eth1394.c:189: warning: inlining failed in call to 'purge_partial_datagram': function body not available
drivers/ieee1394/eth1394.c:403: warning: called from here
drivers/ieee1394/eth1394.c: In function `ether1394_host_reset':
drivers/ieee1394/eth1394.c:189: warning: inlining failed in call to 'purge_partial_datagram': function body not available
drivers/ieee1394/eth1394.c:708: warning: called from here
drivers/ieee1394/eth1394.c: In function `ether1394_data_handler':
drivers/ieee1394/eth1394.c:1029: warning: inlining failed in call to 'new_partial_datagram': function not considered for inlining
drivers/ieee1394/eth1394.c:1197: warning: called from here
drivers/ieee1394/eth1394.c:1029: warning: inlining failed in call to 'new_partial_datagram': function not considered for inlining
drivers/ieee1394/eth1394.c:1215: warning: called from here

CC [M] drivers/net/e1000/e1000_main.o
drivers/net/e1000/e1000_main.c: In function `e1000_up':
drivers/net/e1000/e1000_main.c:136: warning: inlining failed in call to 'e1000_irq_enable': function body not available
drivers/net/e1000/e1000_main.c:274: warning: called from here
drivers/net/e1000/e1000_main.c: In function `e1000_down':
drivers/net/e1000/e1000_main.c:135: warning: inlining failed in call to 'e1000_irq_disable': function body not available
drivers/net/e1000/e1000_main.c:284: warning: called from here
drivers/net/e1000/e1000_main.c: In function `e1000_clean_rx_irq':
drivers/net/e1000/e1000_main.c:155: warning: inlining failed in call to 'e1000_rx_checksum': function body not available
drivers/net/e1000/e1000_main.c:2327: warning: called from here

CC drivers/scsi/sg.o
drivers/scsi/sg.c: In function `sg_ioctl':
drivers/scsi/sg.c:209: warning: inlining failed in call to 'sg_jif_to_ms': function body not available
drivers/scsi/sg.c:930: warning: called from here
drivers/scsi/sg.c: In function `sg_cmd_done':
drivers/scsi/sg.c:209: warning: inlining failed in call to 'sg_jif_to_ms': function body not available
drivers/scsi/sg.c:1253: warning: called from here

CC [M] net/bluetooth/l2cap.o
net/bluetooth/l2cap.c: In function `l2cap_recv_frame':
net/bluetooth/l2cap.c:1637: warning: inlining failed in call to 'l2cap_sig_channel': function not considered for inlining
net/bluetooth/l2cap.c:1793: warning: called from here
net/bluetooth/l2cap.c: In function `l2cap_sig_channel':
net/bluetooth/l2cap.c:1356: warning: inlining failed in call to 'l2cap_connect_req': function not considered for inlining
net/bluetooth/l2cap.c:1661: warning: called from here

CC [M] net/bluetooth/bnep/core.o
net/bluetooth/bnep/core.c: In function `bnep_session':
net/bluetooth/bnep/core.c:293: warning: inlining failed in call to 'bnep_rx_frame': function not considered for inlining
net/bluetooth/bnep/core.c:473: warning: called from here

CC [M] net/bluetooth/rfcomm/core.o
net/bluetooth/rfcomm/core.c: In function `rfcomm_worker':
net/bluetooth/rfcomm/core.c:1695: warning: inlining failed in call to 'rfcomm_process_sessions': function not considered for inlining
net/bluetooth/rfcomm/core.c:1743: warning: called from here

CC [M] net/ipv4/netfilter/ip_tables.o
net/ipv4/netfilter/ip_tables.c: In function `translate_table':
net/ipv4/netfilter/ip_tables.c:671: warning: inlining failed in call to 'check_entry': function not considered for inlining
net/ipv4/netfilter/ip_tables.c:850: warning: called from here

CC [M] net/sunrpc/xprt.o
net/sunrpc/xprt.c: In function `xprt_reserve':
net/sunrpc/xprt.c:84: warning: inlining failed in call to 'do_xprt_reserve': function body not available
net/sunrpc/xprt.c:1307: warning: called from here


--
J.A. Magallon <jamagallon()able!es> \ Software is like sex:
werewolf!able!es \ It's better when it's free
Mandrakelinux release 10.1 (Cooker) for i586
Linux 2.6.7-jam4 (gcc 3.4.1 (Mandrakelinux (Cooker) 3.4.1-0.3mdk)) #2


Attachments:
(No filename) (9.29 kB)
(No filename) (189.00 B)
Download all attachments

2004-06-25 14:55:57

by John Cherry

[permalink] [raw]
Subject: Re: gcc-3.4.1 and -Winline

"J.A. Magallon" wrote:
>
> This are the warnings I get with gcc-3.4.1 CVS, when building
2.6.7-mm2.
> Just for if some is really serious, ie, something that does not work
if
> compiled out-of-line (but I suppose I had noticed ;) ).
> Or if it origins a huge performace penalty.
[...]
>
> CC arch/i386/kernel/timers/timer_tsc.o
> arch/i386/kernel/timers/timer_tsc.c: In function `mark_offset_tsc':
> arch/i386/kernel/timers/timer_tsc.c:30: warning: inlining failed in
call to \
> 'cpufreq_delayed_get': function body not available \
> arch/i386/kernel/timers/timer_tsc.c:248: warning: called from here
[... more warnings deleted for brevity ...]

Well, gcc 3.2.2 with -Winline does not complain, but interestingly
enough sparse does (at least in the above case and some others):

CHECK arch/i386/kernel/timers/timer_tsc.c
arch/i386/kernel/timers/timer_tsc.c:30:39: warning: marked inline, but without a definition

Basically this is a case of having:
#1: static inline void foo(void); /* forward decl without body */
...
#2: void bar(void) { foo(); } /* function using the inline */
...
#3: static inline void foo(void) { return; } /* actual inline def. */
in the above order.

I have not looked at resulting .o file with gcc 3.2.2, but would not be too
surprised if it also silently just ignores the "inline" in lines #1 and #3 above.

There are obviously two trivial fixes above, either just remove the inline (making
foo a normal static function) or reorder #2 and #3.

John


2004-06-25 23:07:21

by Jesper Juhl

[permalink] [raw]
Subject: Re: gcc-3.4.1 and -Winline

On Fri, 25 Jun 2004, John Cherry wrote:

> "J.A. Magallon" wrote:
> >
> > This are the warnings I get with gcc-3.4.1 CVS, when building
> 2.6.7-mm2.
> > Just for if some is really serious, ie, something that does not work
> if
> > compiled out-of-line (but I suppose I had noticed ;) ).
> > Or if it origins a huge performace penalty.
> [...]
> >
> > CC arch/i386/kernel/timers/timer_tsc.o
> > arch/i386/kernel/timers/timer_tsc.c: In function `mark_offset_tsc':
> > arch/i386/kernel/timers/timer_tsc.c:30: warning: inlining failed in
> call to \
> > 'cpufreq_delayed_get': function body not available \
> > arch/i386/kernel/timers/timer_tsc.c:248: warning: called from here
> [... more warnings deleted for brevity ...]
>
> Well, gcc 3.2.2 with -Winline does not complain, but interestingly
> enough sparse does (at least in the above case and some others):
>
> CHECK arch/i386/kernel/timers/timer_tsc.c
> arch/i386/kernel/timers/timer_tsc.c:30:39: warning: marked inline, but without a definition
>
> Basically this is a case of having:
> #1: static inline void foo(void); /* forward decl without body */
> ...
> #2: void bar(void) { foo(); } /* function using the inline */
> ...
> #3: static inline void foo(void) { return; } /* actual inline def. */
> in the above order.
>
> I have not looked at resulting .o file with gcc 3.2.2, but would not be too
> surprised if it also silently just ignores the "inline" in lines #1 and #3 above.
>
> There are obviously two trivial fixes above, either just remove the inline (making
> foo a normal static function) or reorder #2 and #3.
>

I see the same thing here with gcc 3.4.0.
Here's a patch to reorder timer_tsc.c so gcc 3.4 does not fail to inline
and thus fix the warning
"arch/i386/kernel/timers/timer_tsc.c:30: warning: inlining failed in call
to 'cpufreq_delayed_get': function body not available"

Patch is against 2.6.7-mm2

Signed-off-by: Jesper Juhl <[email protected]>

--- linux-2.6.7-mm2-orig/arch/i386/kernel/timers/timer_tsc.c 2004-06-16 07:19:42.000000000 +0200
+++ linux-2.6.7-mm2/arch/i386/kernel/timers/timer_tsc.c 2004-06-26 01:04:26.000000000 +0200
@@ -1,6 +1,10 @@
/*
* This code largely moved from arch/i386/kernel/time.c.
* See comments there for proper credits.
+ *
+ * 2004-06-25 Jesper Juhl
+ * moved mark_offset_tsc below cpufreq_delayed_get to avoid gcc 3.4
+ * failing to inline.
*/

#include <linux/spinlock.h>
@@ -70,7 +74,6 @@ static inline unsigned long long cycles_
return (cyc * cyc2ns_scale) >> CYC2NS_SCALE_FACTOR;
}

-
static int count2; /* counter for mark_offset_tsc() */

/* Cached *multiplier* to convert TSC counts to microseconds.
@@ -152,119 +155,6 @@ unsigned long long sched_clock(void)
return cycles_2_ns(this_offset);
}

-
-static void mark_offset_tsc(void)
-{
- unsigned long lost,delay;
- unsigned long delta = last_tsc_low;
- int count;
- int countmp;
- static int count1 = 0;
- unsigned long long this_offset, last_offset;
- static int lost_count = 0;
-
- write_seqlock(&monotonic_lock);
- last_offset = ((unsigned long long)last_tsc_high<<32)|last_tsc_low;
- /*
- * It is important that these two operations happen almost at
- * the same time. We do the RDTSC stuff first, since it's
- * faster. To avoid any inconsistencies, we need interrupts
- * disabled locally.
- */
-
- /*
- * Interrupts are just disabled locally since the timer irq
- * has the SA_INTERRUPT flag set. -arca
- */
-
- /* read Pentium cycle counter */
-
- rdtsc(last_tsc_low, last_tsc_high);
-
- spin_lock(&i8253_lock);
- outb_p(0x00, PIT_MODE); /* latch the count ASAP */
-
- count = inb_p(PIT_CH0); /* read the latched count */
- count |= inb(PIT_CH0) << 8;
-
- /*
- * VIA686a test code... reset the latch if count > max + 1
- * from timer_pit.c - cjb
- */
- if (count > LATCH) {
- outb_p(0x34, PIT_MODE);
- outb_p(LATCH & 0xff, PIT_CH0);
- outb(LATCH >> 8, PIT_CH0);
- count = LATCH - 1;
- }
-
- spin_unlock(&i8253_lock);
-
- if (pit_latch_buggy) {
- /* get center value of last 3 time lutch */
- if ((count2 >= count && count >= count1)
- || (count1 >= count && count >= count2)) {
- count2 = count1; count1 = count;
- } else if ((count1 >= count2 && count2 >= count)
- || (count >= count2 && count2 >= count1)) {
- countmp = count;count = count2;
- count2 = count1;count1 = countmp;
- } else {
- count2 = count1; count1 = count; count = count1;
- }
- }
-
- /* lost tick compensation */
- delta = last_tsc_low - delta;
- {
- register unsigned long eax, edx;
- eax = delta;
- __asm__("mull %2"
- :"=a" (eax), "=d" (edx)
- :"rm" (fast_gettimeoffset_quotient),
- "0" (eax));
- delta = edx;
- }
- delta += delay_at_last_interrupt;
- lost = delta/(1000000/HZ);
- delay = delta%(1000000/HZ);
- if (lost >= 2) {
- jiffies_64 += lost-1;
-
- /* sanity check to ensure we're not always losing ticks */
- if (lost_count++ > 100) {
- printk(KERN_WARNING "Losing too many ticks!\n");
- printk(KERN_WARNING "TSC cannot be used as a timesource. \n");
- printk(KERN_WARNING "Possible reasons for this are:\n");
- printk(KERN_WARNING " You're running with Speedstep,\n");
- printk(KERN_WARNING " You don't have DMA enabled for your hard disk (see hdparm),\n");
- printk(KERN_WARNING " Incorrect TSC synchronization on an SMP system (see dmesg).\n");
- printk(KERN_WARNING "Falling back to a sane timesource now.\n");
-
- clock_fallback();
- }
- /* ... but give the TSC a fair chance */
- if (lost_count > 25)
- cpufreq_delayed_get();
- } else
- lost_count = 0;
- /* update the monotonic base value */
- this_offset = ((unsigned long long)last_tsc_high<<32)|last_tsc_low;
- monotonic_base += cycles_2_ns(this_offset - last_offset);
- write_sequnlock(&monotonic_lock);
-
- /* calculate delay_at_last_interrupt */
- count = ((LATCH-1) - count) * TICK_SIZE;
- delay_at_last_interrupt = (count + LATCH/2) / LATCH;
-
- /* catch corner case where tick rollover occured
- * between tsc and pit reads (as noted when
- * usec delta is > 90% # of usecs/tick)
- */
- if (lost && abs(delay - delay_at_last_interrupt) > (900000/HZ))
- jiffies_64++;
-}
-
static void delay_tsc(unsigned long loops)
{
unsigned long bclock, now;
@@ -426,6 +316,117 @@ core_initcall(cpufreq_tsc);
static inline void cpufreq_delayed_get(void) { return; }
#endif

+static void mark_offset_tsc(void)
+{
+ unsigned long lost,delay;
+ unsigned long delta = last_tsc_low;
+ int count;
+ int countmp;
+ static int count1 = 0;
+ unsigned long long this_offset, last_offset;
+ static int lost_count = 0;
+
+ write_seqlock(&monotonic_lock);
+ last_offset = ((unsigned long long)last_tsc_high<<32)|last_tsc_low;
+ /*
+ * It is important that these two operations happen almost at
+ * the same time. We do the RDTSC stuff first, since it's
+ * faster. To avoid any inconsistencies, we need interrupts
+ * disabled locally.
+ */
+
+ /*
+ * Interrupts are just disabled locally since the timer irq
+ * has the SA_INTERRUPT flag set. -arca
+ */
+
+ /* read Pentium cycle counter */
+
+ rdtsc(last_tsc_low, last_tsc_high);
+
+ spin_lock(&i8253_lock);
+ outb_p(0x00, PIT_MODE); /* latch the count ASAP */
+
+ count = inb_p(PIT_CH0); /* read the latched count */
+ count |= inb(PIT_CH0) << 8;
+
+ /*
+ * VIA686a test code... reset the latch if count > max + 1
+ * from timer_pit.c - cjb
+ */
+ if (count > LATCH) {
+ outb_p(0x34, PIT_MODE);
+ outb_p(LATCH & 0xff, PIT_CH0);
+ outb(LATCH >> 8, PIT_CH0);
+ count = LATCH - 1;
+ }
+
+ spin_unlock(&i8253_lock);
+
+ if (pit_latch_buggy) {
+ /* get center value of last 3 time lutch */
+ if ((count2 >= count && count >= count1)
+ || (count1 >= count && count >= count2)) {
+ count2 = count1; count1 = count;
+ } else if ((count1 >= count2 && count2 >= count)
+ || (count >= count2 && count2 >= count1)) {
+ countmp = count;count = count2;
+ count2 = count1;count1 = countmp;
+ } else {
+ count2 = count1; count1 = count; count = count1;
+ }
+ }
+
+ /* lost tick compensation */
+ delta = last_tsc_low - delta;
+ {
+ register unsigned long eax, edx;
+ eax = delta;
+ __asm__("mull %2"
+ :"=a" (eax), "=d" (edx)
+ :"rm" (fast_gettimeoffset_quotient),
+ "0" (eax));
+ delta = edx;
+ }
+ delta += delay_at_last_interrupt;
+ lost = delta/(1000000/HZ);
+ delay = delta%(1000000/HZ);
+ if (lost >= 2) {
+ jiffies_64 += lost-1;
+
+ /* sanity check to ensure we're not always losing ticks */
+ if (lost_count++ > 100) {
+ printk(KERN_WARNING "Losing too many ticks!\n");
+ printk(KERN_WARNING "TSC cannot be used as a timesource. \n");
+ printk(KERN_WARNING "Possible reasons for this are:\n");
+ printk(KERN_WARNING " You're running with Speedstep,\n");
+ printk(KERN_WARNING " You don't have DMA enabled for your hard disk (see hdparm),\n");
+ printk(KERN_WARNING " Incorrect TSC synchronization on an SMP system (see dmesg).\n");
+ printk(KERN_WARNING "Falling back to a sane timesource now.\n");
+
+ clock_fallback();
+ }
+ /* ... but give the TSC a fair chance */
+ if (lost_count > 25)
+ cpufreq_delayed_get();
+ } else
+ lost_count = 0;
+ /* update the monotonic base value */
+ this_offset = ((unsigned long long)last_tsc_high<<32)|last_tsc_low;
+ monotonic_base += cycles_2_ns(this_offset - last_offset);
+ write_sequnlock(&monotonic_lock);
+
+ /* calculate delay_at_last_interrupt */
+ count = ((LATCH-1) - count) * TICK_SIZE;
+ delay_at_last_interrupt = (count + LATCH/2) / LATCH;
+
+ /* catch corner case where tick rollover occured
+ * between tsc and pit reads (as noted when
+ * usec delta is > 90% # of usecs/tick)
+ */
+ if (lost && abs(delay - delay_at_last_interrupt) > (900000/HZ))
+ jiffies_64++;
+}

static int __init init_tsc(char* override)
{


--
Jesper Juhl <[email protected]>