Skip to contentSkip to conversation

VLAN and Network Drivers 2.4.x

DISCUSSION [email protected] 20 participants 54 messages Apr 24, 2002 – May 10, 2002

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

Hi,

why is a there a experimental VLAN option in the stable 2.4.x-kernel, when it's useless without patching Network Drivers?

Why isn't there a solution for all network drivers to accept frames 4 bytes longer on request of e.g. vconfig (like ifconfig setting promiscious mode on/off) ? Or to deny vconfig to add a vlan, if the network driver/hardware doesn't support this?

Today the situation is as follows: The experimental VLAN-option is useless, if i dont patch my network drivers, otherwise there is no working VLAN function.

Any future plans?

#1 lore raw

From: [email protected]
Date: Wed, 24 Apr 2002 15:09:09

why is a there a experimental VLAN option in the stable 2.4.x-kernel, when it's useless without patching Network Drivers?

It is not useless for the drivers that have been fixed.

Why isn't there a solution for all network drivers to accept frames 4 bytes longer on request of e.g. vconfig (like ifconfig setting promiscious mode on/off) ? Or to deny vconfig to add a vlan, if the network driver/hardware doesn't support this?

Because the solutions are hardware specific to allow these extra 4 bytes to be received by the card. Some cards, in fact, cannot support VLAN at all because they cannot be programmed at all to take those 4 extra bytes.

Today the situation is as follows: The experimental VLAN-option is useless, if i dont patch my network drivers, otherwise there is no working VLAN function.

No it isn't useless. There are many network drivers for which VLAN works out of the box RIGHT NOW. In fact, many of which support full hardware acceleration of VLAN tagging, for instance Tigon3 is one such device.

#2 lore raw
Quoted 5 lines

Von: <[email protected]>
Gesendet: 24.04.2002 16:11

2.4.x-kernel, when it's useless without patching Network Drivers?
It is not useless for the drivers that have been fixed.

Ok, but i have a stock 2.4.18 kernel, i can enable the VLAN option, recompile the kernel, configure a VLAN without any error or hint.

BUT: If i try to do ftp or ping with a payload greater than 1468 my tulipbased ZNYX 346Q ethernetcards drop those packets. The driver or the card cannot handle those packets. They are to large. Maybe a driverpatch solve my problem - maybe not. The kernel itself doesn't care. vconfig doesn't barf. It silently fails.. not so good behaviour in my opinion. This is why there are always the same questions on the vlan mailinglist.

Quoted 4 lines

Because the solutions are hardware specific to allow these extra 4 bytes to be received by the card. Some cards, in fact, cannot support VLAN at all because they cannot be programmed at all to take those 4 extra bytes.

Ok. But why isn't there a "tag" (capabilities?) on the drivers which let vconfig barf with a message like "underlying network driver or hardware doesn't support VLAN"?

Quoted 2 lines

No it isn't useless. There are many network drivers for which VLAN works out of the box RIGHT NOW.

Ok. But i don't get a message about the drivers which don't work. Which driver work/which not? Isn't it easier to tag all drivers as not VLAN-ready till somebody make a patch or confirm that its working with VLAN?

On the other side, my ZNYX works "out of the box" too. It works till 1468 Bytes ;) - I tend to say that ALL nic-drivers/hardware work till 1468 Bytes. But its not the intention of VLAN to lower the MTU on each Client.

#3 lore raw
Quoted 6 lines · On Wed, 24 Apr 2002 [email protected] wrote:
Quoted 5 lines

Von: <[email protected]>
Gesendet: 24.04.2002 16:11

2.4.x-kernel, when it's useless without patching Network Drivers?
It is not useless for the drivers that have been fixed.

Quoted 9 lines

Ok, but i have a stock 2.4.18 kernel, i can enable the VLAN option, recompile the kernel, configure a VLAN without any error or hint.

BUT: If i try to do ftp or ping with a payload greater than 1468 my tulipbased ZNYX 346Q ethernetcards drop those packets. The driver or the card cannot handle those packets. They are to large. Maybe a driverpatch solve my problem - maybe not. The kernel itself doesn't care. vconfig doesn't barf. It silently fails.. not so good behaviour in my opinion. This is why there are always the same questions on the vlan mailinglist.

See linux-kernel archives.. some time ago Paul P Komkoff Jr <[email protected]> posted a patch for tulip to make VLANs work.. the subject of the post was something like "tulip and VLAN tagging".

Quoted 5 lines
Quoted 4 lines

Because the solutions are hardware specific to allow these extra 4 bytes to be received by the card. Some cards, in fact, cannot support VLAN at all because they cannot be programmed at all to take those 4 extra bytes.

Quoted 9 lines

Ok. But why isn't there a "tag" (capabilities?) on the drivers which let vconfig barf with a message like "underlying network driver or hardware doesn't support VLAN"?

Quoted 2 lines

No it isn't useless. There are many network drivers for which VLAN works out of the box RIGHT NOW.

Ok. But i don't get a message about the drivers which don't work. Which driver work/which not? Isn't it easier to tag all drivers as not VLAN-ready till somebody make a patch or confirm that its working with VLAN?

On the other side, my ZNYX works "out of the box" too. It works till 1468 Bytes ;) - I tend to say that ALL nic-drivers/hardware work till 1468 Bytes. But its not the intention of VLAN to lower the MTU on each Client.

- Pasi Kärkkäinen

                                   ^
                                .     .
                                 Linux
                              /    -    \
                             Choice.of.the
                           .Next.Generation.
#4 lore raw
In reply to [email protected]

From: [email protected]
Date: Wed, 24 Apr 2002 18:23:35 +0200

Ok. But why isn't there a "tag" (capabilities?) on the drivers which let vconfig barf with a message like "underlying network driver or hardware doesn't support VLAN"?

There actually is a flag the driver can set fo this purpose.

Someone should walk over all the drivers that are known to not work currently with VLAN and for them to set the NETIF_F_VLAN_CHALLENGED flag.

Another idea, is to do the opposite, set that flag by default and clear it in drivers that we know it works.

#5 lore raw
Quoted 4 lines

Von: <[email protected]>
Gesendet: 24.04.2002 18:45

There actually is a flag the driver can set fo this purpose.

Oh. Even in 2.4 ?

Quoted 3 lines

Someone should walk over all the drivers that are known to not work currently with VLAN and for them to set the NETIF_F_VLAN_CHALLENGED flag.

That's a good idea. So vconfig could check, if its possible to create a VLAN on top of such a driver - and issue a message if not.

Quoted 2 lines

Another idea, is to do the opposite, set that flag by default and clear it in drivers that we know it works.

It depends - if all drivers must be changed or just those, who support VLAN. I tend to a solution where just the VLAN-capable drivers should be changed.

#6 lore raw

From: [email protected]
Date: Wed, 24 Apr 2002 19:03:19 +0200

Oh. Even in 2.4 ?

Yes, the "cannot do VLAN" flag is there in 2.4.x

That's a good idea. So vconfig could check, if its possible to create a VLAN on top of such a driver - and issue a message if not.

VLAN layer checks this and fails to bring up VLAN if flag is set for the device being configured. I'm way ahead of you.

Franks a lot,
David S. Miller
[email protected]

#7 lore raw
Quoted 3 lines

Von: <[email protected]>
Gesendet: 24.04.2002 19:10
Yes, the "cannot do VLAN" flag is there in 2.4.x

Mhh, did not found the symbol in netdevice.h on stock 2.4.18.

Quoted 3 lines

VLAN layer checks this and fails to bring up VLAN if flag is set for the device being configured. I'm way ahead of you.

Ok, awaiting your changes.

Greetings

Jochen Dolze

#8 lore raw

From: [email protected]
Date: Wed, 24 Apr 2002 19:42:24 +0200

Quoted 3 lines

Von: <[email protected]>
Gesendet: 24.04.2002 19:10
Yes, the "cannot do VLAN" flag is there in 2.4.x

Mhh, did not found the symbol in netdevice.h on stock 2.4.18.

See 2.4.19-preX

#9 lore raw
Quoted 5 lines

Von: <[email protected]>
Gesendet: 24.04.2002 19:50

Mhh, did not found the symbol in netdevice.h on stock 2.4.18.
See 2.4.19-preX

Ok. I think NETIF_F_VLAN_CHALLENGED should be set if the device or driver can handle VLAN.
So older third party drivers (based on < 2.4.19) get denied at first, till the driver maintainer explicitly set the NETIF_F_VLAN_CHALLENDGED capability (or one of the VLAN-hardware capabilities).

Greetings

Jochen Dolze

#10 lore raw

From: [email protected]
Date: Thu, 25 Apr 2002 00:28:05 +0200

Ok. I think NETIF_F_VLAN_CHALLENGED should be set if the device or driver can handle VLAN.

No, "challenged" means "cannot handle". Do not invert the meaning, the macro says what the meaning is.

To get the behavior you want, we set the flat by default and drivers for devices which are deemed "VLAN capable" can set the bit themselves.

#11 lore raw

Re: AW: Re: AW: Re: AW: Re: AW: Re: AW: Re: AW: Re: AW: [was: VLAN and Network Drivers 2.4.x]

Uhhhh. What's up with the subject line? Somehow I suspect that it is related to MS Outlook and "embracing and breaking" standards.

Dax Kelson

#12 lore raw

Re: AW: Re: AW: Re: AW: Re: AW: Re: AW: Re: AW: Re: AW: [was: VLAN and Network Drivers 2.4.x]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 2 lines · On April 24, 2002 21:40, I wrote:

It seems to be related to "avixxmail 1.2.2.7", used by Dax Kelson <[email protected]>. "AW" is probably a localized reply prefix, and his

Eh, sorry, I meant [email protected] of course

- -Ryan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAjzHiWQACgkQLGMzRzbJfbT25gCeIlox3XaPYgo+JrnWNm9rSm0a C9IAni5wRvrBcH5N1UlwDEWpoQXx8oYe
=EH5J
-----END PGP SIGNATURE-----

#13 lore raw

Re: [was: VLAN and Network Drivers 2.4.x]

In reply to David S. Miller
Quoted 2 lines · Dax Kelson

Uhhhh. What's up with the subject line? Somehow I suspect that it is related to MS Outlook and "embracing and breaking" standards.

MS Outlook should be configured to use English attribution and Subject tags. It's possible, but not the default setting.

(Apart from that, Outlook should be precluded from mailing lists for technical reasons, the most important being improper quote marks on base64/quoted-printable encoded mails.)

Signature · 1 line
Matthias Andree
#14 lore raw
In reply to David S. Miller
Quoted 7 lines

Von: <[email protected]>
Gesendet: 25.04.2002 00:33

Ok. I think NETIF_F_VLAN_CHALLENGED should be set if the device or driver can handle VLAN.
No, "challenged" means "cannot handle". Do not invert the meaning, the macro says what the meaning is.

Why not call it NETIF_F_VLAN ?

Quoted 1 line

To get the behavior you want, we set the flat by default

What does this mean, "set the flat by default", setting NETIF_F_VLAN_CHALLENGED by default?

Quoted 3 lines

and drivers
for devices which are deemed "VLAN capable" can set the bit themselves.

If it works for older thirdparty (< 2.4.19) driver too (without any changes - only recompile), it would be great.

Greetings

Jochen Dolze

#15 lore raw

From: [email protected]
Date: Thu, 25 Apr 2002 15:45:59 +0200

Quoted 2 lines

No, "challenged" means "cannot handle". Do not invert the meaning, the macro says what the meaning is.

Why not call it NETIF_F_VLAN ?

BTW, your mail client's mangling of subject lines is REALLY ANNOYING.

We don't call it NETIF_F_VLAN because the hope is that eventually it will be rare for a network device to not be able to support it. Not the other day around.

Please fix your mail client before replying anymore, ok? Thanks.

Franks a lot,
David S. Miller
[email protected]

#16 lore raw
Quoted 4 lines

Von: <[email protected]>
Gesendet: 26.04.2002 02:57

BTW, your mail client's mangling of subject lines is REALLY ANNOYING.

Sorry, i fixed it.

Quoted 3 lines

We don't call it NETIF_F_VLAN because the hope is that eventually it will be rare for a network device to not be able to support it. Not the other day around.

I don't know how many cards won't support VLAN nowadays. But i will test these changes with my third party driver (just recompile it against pre-2.4.19) and report the results.

Greetings

Jochen Dolze

#17 lore raw

From: [email protected]
Date: Sat, 27 Apr 2002 22:34:09 +0200

Quoted 3 lines

We don't call it NETIF_F_VLAN because the hope is that eventually it will be rare for a network device to not be able to support it. Not the other day around.

I don't know how many cards won't support VLAN nowadays. But i will test these changes with my third party driver (just recompile it against pre-2.4.19) and report the results.

This will tell us exactly nothing. It will continue to tell us nothing until I make the change whereby NETIF_F_VLAN_CHALLENGED is set by default and devices known to work are updated to clear it.

Please don't bother posting the results, we know what will happen.

#18 lore raw
Quoted 10 lines

Von: <[email protected]>
Gesendet: 28.04.2002 04:54

I don't know how many cards won't support VLAN nowadays. But i will test these changes with my third party driver (just recompile it against pre-2.4.19) and report the results.

This will tell us exactly nothing. It will continue to tell us nothing until I make the change whereby NETIF_F_VLAN_CHALLENGED is set by default and devices known to work are updated to clear it.

Then i understood it right. I hope your change is made in this way only for the 2.5 tree. Changing all drivers is ok for 2.5, but most third party driver supplier update their drivers only rarely.

Quoted 1 line

Please don't bother posting the results, we know what will happen.

I think your solution is ok for 2.5 but not for 2.4. On the 2.4 series it would be easier to add a flag which is set if the driver is VLAN ready. This wouldn't break third party drivers, which are not VLAN ready. And vconfig would report the right thing without changing any driver code (as it was intended by one of my former postings).

Greetings

Jochen Dolze

#19 lore raw

From: [email protected]
Date: Sun, 28 Apr 2002 22:28:06 +0200

Quoted 1 line

Please don't bother posting the results, we know what will happen.

I think your solution is ok for 2.5 but not for 2.4. On the 2.4 series it would be easier to add a flag which is set if the driver is VLAN ready.

Will you at least listen to what my proposed solution is? It has precisely the same effect your proposal has.

Let me say it for millionth time:

Networking sets "can't VLAN" by default in device flags, if device driver clear it we can do VLAN. So by default device is marked as not VLAN capable.

This is exactly the behavior you are asking for. There is no fundamental difference between your scheme and mine except that I am being required to retype a description of mine a million times.

#20 lore raw
Quoted 13 lines

Von: <[email protected]>
Gesendet: 29.04.2002 06:00

Will you at least listen to what my proposed solution is? It has precisely the same effect your proposal has. Let me say it for millionth time:
Networking sets "can't VLAN" by default in device flags, if device driver clear it we can do VLAN. So by default device is marked as not VLAN capable.
This is exactly the behavior you are asking for. There is no fundamental difference between your scheme and mine except that I am being required to retype a description of mine a million times.

Sorry, i didn't got it. Now its clear. I missed that the device flags are set in the networking code too and not only in the driver. I apologize me for the former posts.

Greetings

Jochen Dolze

#21 lore raw

Re: Accurately measure CPU cycles used by a program? thanks

In reply to David S. Miller
Quoted 4 lines · On 2002.04.30 Wanghong Yuan wrote:

Is there any package or program, which can be used to accurately measure the CPU cycles used by a program? I think the following code can only provide an inaccurate one, beause it may count on the waiting time of the program.

Quoted 8 lines

gettimeofday(t1)
runprogam
gettimeofday(t2)
t2-t1

If I need to instrument the kernel, which part I should investigate? Thanks a lot in advance

man getrusage

Signature · 4 lines
J.A. Magallon                           #  Let the source be with you...        
mailto:[email protected]
Mandrake Linux release 8.3 (Cooker) for i586
Linux werewolf 2.4.19-pre7-jam7 #1 SMP jue abr 25 00:19:56 CEST 2002 i686
#22 lore raw

Re: Accurately measure CPU cycles used by a program? thanks

In reply to David S. Miller
Quoted 4 lines
Quoted 2 lines

Is there any package or program, which can be used to accurately measure the CPU cycles used by a program? I think the following code can only provide an

man getrusage

There is a measurable chance that getrusage isn't good enough, something like perfctr ( http://www.csd.uu.se/~mikpe/linux/perfctr/ ) that actually measures cpu events may be more insteresting. See also:
http://oprofile.sourceforge.net/

- z

#23 lore raw

Re: Accurately measure CPU cycles used by a program? thanks

In reply to David S. Miller
Quoted 11 lines · J.A. Magallon
Quoted 9 lines · On 2002.04.30 Wanghong Yuan wrote:

Is there any package or program, which can be used to accurately measure the CPU cycles used by a program? I think the following code can only provide an inaccurate one, beause it may count on the waiting time of the program.

gettimeofday(t1)
runprogam
gettimeofday(t2)
t2-t1

Quoted 6 lines
Quoted 3 lines

If I need to instrument the kernel, which part I should investigate? Thanks a lot in advance

man getrusage

getrusage is grossly inaccurate. If a process is running when the timer interrupt hits, it's assigned an entire timer interrupt's worth of CPU, even if it's only run one instruction. I've attached an old patch that makes getrusage farily accurate. It's not going to be accurate to the CPU cycle, but it's not too bad. It does increase the overhead for system calls and interrupts. It works on newer x86 and PowerPC.

-Corey

fs/proc/proc_misc.c renamed from fs/proc/proc_misc.c.highres +2 -1
@@ -101,7 +101,8 @@
 	int len;
 
 	uptime = jiffies;
-	idle = init_tasks[0]->times.tms_utime + init_tasks[0]->times.tms_stime;
+	idle = (tms_time_to_ticks(init_tasks[0]->times.tms_utime)
+		+ tms_time_to_ticks(init_tasks[0]->times.tms_stime));
 
 	/* The formula for the fraction parts really is ((t * 100) / HZ) % 100, but
 	   that would overflow about every five days at HZ == 100.
fs/proc/array.c renamed from fs/proc/array.c.highres +6 -6
@@ -358,10 +358,10 @@
 		task->cmin_flt,
 		task->maj_flt,
 		task->cmaj_flt,
-		task->times.tms_utime,
-		task->times.tms_stime,
-		task->times.tms_cutime,
-		task->times.tms_cstime,
+		tms_time_to_ticks(task->times.tms_utime),
+		tms_time_to_ticks(task->times.tms_stime),
+		tms_time_to_ticks(task->times.tms_cutime),
+		tms_time_to_ticks(task->times.tms_cstime),
 		priority,
 		nice,
 		0UL /* removed */,
@@ -682,8 +682,8 @@
 
 	len = sprintf(buffer,
 		"cpu  %lu %lu\n",
-		task->times.tms_utime,
-		task->times.tms_stime);
+		tms_time_to_ticks(task->times.tms_utime),
+		tms_time_to_ticks(task->times.tms_stime));
 		
 	for (i = 0 ; i < smp_num_cpus; i++)
 		len += sprintf(buffer + len, "cpu%d %lu %lu\n",
fs/binfmt_elf.c renamed from fs/binfmt_elf.c.highres +4 -8
@@ -1105,14 +1105,10 @@
 	psinfo.pr_ppid = prstatus.pr_ppid = current->p_pptr->pid;
 	psinfo.pr_pgrp = prstatus.pr_pgrp = current->pgrp;
 	psinfo.pr_sid = prstatus.pr_sid = current->session;
-	prstatus.pr_utime.tv_sec = CT_TO_SECS(current->times.tms_utime);
-	prstatus.pr_utime.tv_usec = CT_TO_USECS(current->times.tms_utime);
-	prstatus.pr_stime.tv_sec = CT_TO_SECS(current->times.tms_stime);
-	prstatus.pr_stime.tv_usec = CT_TO_USECS(current->times.tms_stime);
-	prstatus.pr_cutime.tv_sec = CT_TO_SECS(current->times.tms_cutime);
-	prstatus.pr_cutime.tv_usec = CT_TO_USECS(current->times.tms_cutime);
-	prstatus.pr_cstime.tv_sec = CT_TO_SECS(current->times.tms_cstime);
-	prstatus.pr_cstime.tv_usec = CT_TO_USECS(current->times.tms_cstime);
+	prstatus.pr_utime = tms_time_to_timeval(current->times.tms_utime);
+	prstatus.pr_stime = tms_time_to_timeval(current->times.tms_stime);
+	prstatus.pr_cutime = tms_time_to_timeval(current->times.tms_cutime);
+	prstatus.pr_cstime = tms_time_to_timeval(current->times.tms_cstime);
 
 	/*
 	 * This transfers the registers from regs into the standard
mm/oom_kill.c renamed from mm/oom_kill.c.highres +3 -1
@@ -72,7 +72,9 @@
 	 * very well in practice. This is not safe against jiffie wraps
 	 * but we don't care _that_ much...
 	 */
-	cpu_time = (p->times.tms_utime + p->times.tms_stime) >> (SHIFT_HZ + 3);
+	cpu_time = (tms_time_to_ticks(p->times.tms_utime)
+		    + tms_time_to_ticks(p->times.tms_stime))
+			>> (SHIFT_HZ + 3);
 	run_time = (jiffies - p->start_time) >> (SHIFT_HZ + 10);
 
 	points /= int_sqrt(cpu_time);
arch/ppc/config.in renamed from arch/ppc/config.in.highres +5 -0
@@ -237,6 +237,11 @@
   source drivers/zorro/Config.in
 fi
 
+bool 'High resolution CPU usage and virtual itimers' CONFIG_HIGHRES_CPU_USAGE
+if [ "$CONFIG_HIGHRES_CPU_USAGE" = "y" ]; then
+  bool 'Does the virtual itimer count system CPU usage?' CONFIG_VIRT_ITIMER_COUNTS_SYSTEM
+fi
+
 endmenu
 source drivers/mtd/Config.in
 source drivers/pnp/Config.in
arch/ppc/kernel/entry.S renamed from arch/ppc/kernel/entry.S.highres +4 -0
@@ -298,6 +298,10 @@
 ret_to_user_hook:
 	nop
 restore:
+#ifdef CONFIG_HIGHRES_CPU_USAGE
+	mr	r3,r2
+	bl	tms_leave_system
+#endif
 	lwz	r3,_XER(r1)
 	mtspr	XER,r3
 	REST_10GPRS(9,r1)
arch/ppc/kernel/time.c renamed from arch/ppc/kernel/time.c.highres +29 -0
@@ -243,6 +243,35 @@
 	tv->tv_usec = usec;
 }
 
+#ifdef CONFIG_HIGHRES_CPU_USAGE
+unsigned long curr_timestamp(void)
+{
+        return get_native_tbl();
+}
+
+unsigned long timestamp_usec_diff(unsigned long ts1, unsigned long ts2)
+{
+        unsigned long val;
+	unsigned long usec;
+
+	if (__USE_RTC()) {
+	        int delta = ts1 - ts2;
+		val = delta<0 ? delta + 1000000000 : delta;
+	} else {
+        	val = ts1 - ts2;
+	}
+	usec = mulhwu(tb_to_us, val);
+	if (usec > 1000000) {
+		/* We had some wierd overflow due to the timebases being
+		   changed, just ignore it. */
+		printk("tb went backwards? ts1=%lu, ts2=%ld\n", ts1, ts2);
+		usec = 0;
+	}
+
+	return usec;
+}
+#endif
+
 void do_settimeofday(struct timeval *tv)
 {
 	unsigned long flags;
arch/ppc/kernel/head.S renamed from arch/ppc/kernel/head.S.highres +45 -0

62 lines not on this page · raw message

arch/i386/config.in renamed from arch/i386/config.in.highres +3 -0
@@ -279,6 +279,9 @@
    bool '    Use real mode APM BIOS call to power off' CONFIG_APM_REAL_MODE_POWER_OFF
 fi
 
+dep_bool 'High resolution CPU usage and virtual itimers' CONFIG_HIGHRES_CPU_USAGE $CONFIG_X86_TSC
+dep_bool 'Does the virtual itimer count system CPU usage?' CONFIG_VIRT_ITIMER_COUNTS_SYSTEM $CONFIG_HIGHRES_CPU_USAGE
+
 endmenu
 
 source drivers/mtd/Config.in
arch/i386/kernel/entry.S renamed from arch/i386/kernel/entry.S.highres +27 -5
@@ -81,6 +81,27 @@
 
 ENOSYS = 38
 
+#define GET_CURRENT(reg) \
+	movl $-8192, reg; \
+	andl %esp, reg
+
+#ifdef CONFIG_HIGHRES_CPU_USAGE
+#define HIGHRES_START_CODE \
+	pushl %eax;        \
+	GET_CURRENT(%ebx); \
+	pushl %ebx;        \
+	call  SYMBOL_NAME(tms_enter_system); \
+	addl  $4,%esp;     \
+	popl %eax; 
+#define HIGHRES_END_CODE \
+	GET_CURRENT(%ebx); \
+	pushl %ebx;        \
+	call  SYMBOL_NAME(tms_leave_system); \
+	addl  $4,%esp; 
+#else
+#define HIGHRES_START_CODE
+#define HIGHRES_END_CODE
+#endif
 
 #define SAVE_ALL \
 	cld; \
@@ -95,9 +116,11 @@
 	pushl %ebx; \
 	movl $(__KERNEL_DS),%edx; \
 	movl %edx,%ds; \
-	movl %edx,%es;
+	movl %edx,%es; \
+	HIGHRES_START_CODE;
 
 #define RESTORE_ALL	\
+	HIGHRES_END_CODE; \
 	popl %ebx;	\
 	popl %ecx;	\
 	popl %edx;	\
@@ -128,10 +151,6 @@
 	.long 3b,6b;	\
 .previous
 
-#define GET_CURRENT(reg) \
-	movl $-8192, reg; \
-	andl %esp, reg
-
 ENTRY(lcall7)
 	pushfl			# We get a different stack layout with call gates,
 	pushl %eax		# which has to be cleaned up later..
@@ -286,6 +305,9 @@
 	movl $(__KERNEL_DS),%edx
 	movl %edx,%ds
 	movl %edx,%es
+	pushl %edi
+	HIGHRES_START_CODE
+	popl %edi
 	GET_CURRENT(%ebx)
 	call *%edi
 	addl $8,%esp
arch/i386/kernel/time.c renamed from arch/i386/kernel/time.c.highres +31 -0
@@ -715,3 +715,34 @@
 	setup_irq(0, &irq0);
 #endif
 }
+
+#ifdef CONFIG_HIGHRES_CPU_USAGE
+unsigned long curr_timestamp(void)
+{
+	register unsigned long eax, edx;
+	rdtsc(eax,edx);
+	return eax;
+}
+
+unsigned long timestamp_usec_diff(unsigned long ts1, unsigned long ts2)
+{
+	register unsigned long eax, rv;
+
+	/* Read the Time Stamp Counter */
+
+	eax = ts1 - ts2;
+	__asm__("mull %2"
+		:"=a" (eax), "=d" (rv)
+		:"rm" (fast_gettimeoffset_quotient),
+		 "0" (eax));
+
+	if (rv >= 1000000) {
+		/* We had some wierd overflow due to the timebases being
+		   changed, just ignore it. */
+		printk("tb went backwards? ts1=%lu, ts2=%ld\n", ts1, ts2);
+		rv = 0;
+	}
+
+	return rv;
+}
+#endif
kernel/acct.c renamed from kernel/acct.c.highres +2 -2
@@ -296,8 +296,8 @@
 
 	ac.ac_btime = CT_TO_SECS(current->start_time) + (xtime.tv_sec - (jiffies / HZ));
 	ac.ac_etime = encode_comp_t(jiffies - current->start_time);
-	ac.ac_utime = encode_comp_t(current->times.tms_utime);
-	ac.ac_stime = encode_comp_t(current->times.tms_stime);
+	ac.ac_utime = encode_comp_t(tms_time_to_ticks(current->times.tms_utime));
+	ac.ac_stime = encode_comp_t(tms_time_to_ticks(current->times.tms_stime));
 	ac.ac_uid = current->uid;
 	ac.ac_gid = current->gid;
 	ac.ac_tty = (current->tty) ? kdev_t_to_nr(current->tty->device) : 0;
kernel/timer.c renamed from kernel/timer.c.highres +144 -0

164 lines not on this page · raw message

kernel/fork.c renamed from kernel/fork.c.highres +14 -4
@@ -626,15 +626,25 @@
 	p->sigpending = 0;
 	init_sigpending(&p->pending);
 
-	p->it_real_value = p->it_virt_value = p->it_prof_value = 0;
-	p->it_real_incr = p->it_virt_incr = p->it_prof_incr = 0;
+	p->it_real_value = p->it_prof_value = 0;
+	p->it_real_incr = p->it_prof_incr = 0;
+#ifndef CONFIG_HIGHRES_CPU_USAGE
+	p->it_virt_value = p->it_virt_incr = 0;
+#else
+	p->it_virt_value.tv_sec = p->it_virt_value.tv_usec = 0;
+	p->it_virt_incr.tv_sec = p->it_virt_incr.tv_usec = 0;
+	/* We start out in system code. */
+	p->system_code_nest = 1;
+#endif
 	init_timer(&p->real_timer);
 	p->real_timer.data = (unsigned long) p;
 
 	p->leader = 0;		/* session leadership doesn't inherit */
 	p->tty_old_pgrp = 0;
-	p->times.tms_utime = p->times.tms_stime = 0;
-	p->times.tms_cutime = p->times.tms_cstime = 0;
+	init_tms_time(&(p->times.tms_utime));
+	init_tms_time(&(p->times.tms_stime));
+	init_tms_time(&(p->times.tms_cutime));
+	init_tms_time(&(p->times.tms_cstime));
 #ifdef CONFIG_SMP
 	{
 		int i;
kernel/sys.c renamed from kernel/sys.c.highres +29 -14

76 lines not on this page · raw message

kernel/itimer.c renamed from kernel/itimer.c.highres +35 -4
@@ -58,20 +58,35 @@
 			if ((long) val <= 0)
 				val = 1;
 		}
+		jiffiestotv(val, &value->it_value);
+		jiffiestotv(interval, &value->it_interval);
 		break;
 	case ITIMER_VIRTUAL:
+#ifndef CONFIG_HIGHRES_CPU_USAGE
 		val = current->it_virt_value;
 		interval = current->it_virt_incr;
+		jiffiestotv(val, &value->it_value);
+		jiffiestotv(interval, &value->it_interval);
+#else
+		{
+			unsigned long flags;
+
+			read_lock_irqsave(&virt_itimer_lock, flags);
+			value->it_value = current->it_virt_value;
+			value->it_interval = current->it_virt_incr;
+			read_unlock_irqrestore(&virt_itimer_lock, flags);
+		}
+#endif
 		break;
 	case ITIMER_PROF:
 		val = current->it_prof_value;
 		interval = current->it_prof_incr;
+		jiffiestotv(val, &value->it_value);
+		jiffiestotv(interval, &value->it_interval);
 		break;
 	default:
 		return(-EINVAL);
 	}
-	jiffiestotv(val, &value->it_value);
-	jiffiestotv(interval, &value->it_interval);
 	return 0;
 }
 
@@ -110,12 +125,12 @@
 	register unsigned long i, j;
 	int k;
 
-	i = tvtojiffies(&value->it_interval);
-	j = tvtojiffies(&value->it_value);
 	if (ovalue && (k = do_getitimer(which, ovalue)) < 0)
 		return k;
 	switch (which) {
 		case ITIMER_REAL:
+			i = tvtojiffies(&value->it_interval);
+			j = tvtojiffies(&value->it_value);
 			del_timer_sync(&current->real_timer);
 			current->it_real_value = j;
 			current->it_real_incr = i;
@@ -128,12 +143,28 @@
 			add_timer(&current->real_timer);
 			break;
 		case ITIMER_VIRTUAL:
+#ifndef CONFIG_HIGHRES_CPU_USAGE
+			i = tvtojiffies(&value->it_interval);
+			j = tvtojiffies(&value->it_value);
 			if (j)
 				j++;
 			current->it_virt_value = j;
 			current->it_virt_incr = i;
+#else
+			{
+				unsigned long flags;
+
+				write_lock_irqsave(&virt_itimer_lock, flags);
+				current->it_virt_value = value->it_value;
+				current->it_virt_incr = value->it_interval;
+				write_unlock_irqrestore(&virt_itimer_lock,
+							flags);
+			}
+#endif
 			break;
 		case ITIMER_PROF:
+			i = tvtojiffies(&value->it_interval);
+			j = tvtojiffies(&value->it_value);
 			if (j)
 				j++;
 			current->it_prof_value = j;
kernel/exit.c renamed from kernel/exit.c.highres +13 -2
@@ -535,8 +535,19 @@
 				}
 				goto end_wait4;
 			case TASK_ZOMBIE:
-				current->times.tms_cutime += p->times.tms_utime + p->times.tms_cutime;
-				current->times.tms_cstime += p->times.tms_stime + p->times.tms_cstime;
+				current->times.tms_cutime
+				    = add_tms_times(current->times.tms_utime,
+						    p->times.tms_utime);
+				current->times.tms_cutime
+				    = add_tms_times(current->times.tms_cutime,
+						    p->times.tms_cutime);
+				current->times.tms_cstime
+				    = add_tms_times(current->times.tms_stime,
+						    p->times.tms_stime);
+				current->times.tms_cstime
+				    = add_tms_times(current->times.tms_cstime,
+						    p->times.tms_cstime);
+
 				read_unlock(&tasklist_lock);
 				retval = ru ? getrusage(p, RUSAGE_BOTH, ru) : 0;
 				if (!retval && stat_addr)
kernel/signal.c renamed from kernel/signal.c.highres +2 -2
@@ -742,8 +742,8 @@
 	info.si_uid = tsk->uid;
 
 	/* FIXME: find out whether or not this is supposed to be c*time. */
-	info.si_utime = tsk->times.tms_utime;
-	info.si_stime = tsk->times.tms_stime;
+	info.si_utime = tms_time_to_ticks(tsk->times.tms_utime);
+	info.si_stime = tms_time_to_ticks(tsk->times.tms_stime);
 
 	status = tsk->exit_code & 0x7f;
 	why = SI_KERNEL;	/* shouldn't happen */
kernel/sched.c renamed from kernel/sched.c.highres +2 -0
@@ -694,6 +694,8 @@
 	 * This just switches the register state and the
 	 * stack.
 	 */
+	tms_task_stopped_running(prev);
+	tms_task_started_running(next);
 	switch_to(prev, next, prev);
 	__schedule_tail(prev);
 
Documentation/Configure.help renamed from Documentation/Configure.help.highres +13 -0
@@ -19794,6 +19794,19 @@
 
   "Area6" will work for most boards. For ADX, select "Area5".
 
+High resolution CPU usage and virtual itimers
+CONFIG_HIGHRES_CPU_USAGE
+  If you say Y here, the cpu usage tracked for programs and virtual itimers
+  will be much higher precision.  The downside of this is that the system
+  call overhead will go up some (every entry into and out of the kernel must
+  be tracked).  Also, the architecture must support high-res timers of
+  some kind and the support must be added to the architecture code.
+
+Does the virtual itimer count system CPU usage?
+CONFIG_VIRT_ITIMER_COUNTS_SYSTEM
+  If highres CPU is counted, this sets whether virtual itimers count system
+  CPU used towards the amount of CPU until the virtual timer goes off.
+
 #
 # m68k-specific kernel options
 # Documented by Chris Lawrence <mailto:[email protected]> et al.
include/linux/sched.h renamed from include/linux/sched.h.highres +140 -3

168 lines not on this page · raw message

include/asm-i386/hw_irq.h renamed from include/asm-i386/hw_irq.h.highres +18 -5
@@ -95,6 +95,22 @@
 #define __STR(x) #x
 #define STR(x) __STR(x)
 
+#define GET_CURRENT \
+	"movl %esp, %ebx\n\t" \
+	"andl $-8192, %ebx\n\t"
+
+#ifdef CONFIG_HIGHRES_CPU_USAGE
+#define HIGHRES_START_CODE \
+	"pushl %eax\n\t"		          \
+	GET_CURRENT				  \
+	"pushl %ebx\n\t"			  \
+	"call  " SYMBOL_NAME_STR(tms_enter_system) "\n\t" \
+	"addl  $4,%esp\n\t"			  \
+	"popl %eax\n\t" 
+#else
+#define HIGHRES_START_CODE
+#endif
+
 #define SAVE_ALL \
 	"cld\n\t" \
 	"pushl %es\n\t" \
@@ -108,14 +124,11 @@
 	"pushl %ebx\n\t" \
 	"movl $" STR(__KERNEL_DS) ",%edx\n\t" \
 	"movl %edx,%ds\n\t" \
-	"movl %edx,%es\n\t"
+	"movl %edx,%es\n\t" \
+        HIGHRES_START_CODE
 
 #define IRQ_NAME2(nr) nr##_interrupt(void)
 #define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr)
-
-#define GET_CURRENT \
-	"movl %esp, %ebx\n\t" \
-	"andl $-8192, %ebx\n\t"
 
 /*
  *	SMP has a few special interrupts for IPI messages
#24 lore raw

How to enable printk

In reply to David S. Miller

Hi,

It may be a simple question. But I cannot see the result of printk in console like the following. Do i need to enable it somewhere? Thanks

/*-O2 -Wall -DMODULE -D__KERNEL__ -DLINUX -c testsys.c */

#include <linux/sys.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <sys/syscall.h>
#include <asm/uaccess.h>

/* The system call number we attempt to install ourselves as. */ static int syscall_num = 165;

asmlinkage int sys_test(int pid, int period, int cycles, int* ptr)

{

put_user(current->pid, ptr);
return pid-10000;

}

extern int sys_call_table[];

#ifdef MODULE
int init_module(void)
{
printk("yes\n");
sys_call_table[syscall_num] = (int)sys_test;
return 0;
}

void cleanup_module(void)
{
sys_call_table[syscall_num] = 0;
}

#endif /* MODULE */

#25 lore raw

Re: How to enable printk

In default priority printk maybe don't show anything on terminal, try printk("<1>yes\n"). Remenber that you can't use xterm.

Uilton Dutra
[email protected]
http://iam.uiltrix.com.br

On Mon, 29 Apr 2002 00:20:11 -0500
"Wanghong Yuan" <[email protected]> wrote:

//Hi,
//
//It may be a simple question. But I cannot see the result of printk in //console like the following. Do i need to enable it somewhere? Thanks //
///*-O2 -Wall -DMODULE -D__KERNEL__ -DLINUX -c testsys.c */ //
//#include <linux/sys.h>
//#include <linux/mm.h>
//#include <linux/module.h>
//#include <linux/kernel.h>
//#include <linux/sched.h>
//#include <sys/syscall.h>
//#include <asm/uaccess.h>
//
//
///* The system call number we attempt to install ourselves as. */ //static int syscall_num = 165;
//
//asmlinkage int sys_test(int pid, int period, int cycles, int* ptr) //
//{
//
// put_user(current->pid, ptr);
// return pid-10000;
//
//}
//
//extern int sys_call_table[];
//
//#ifdef MODULE
//int init_module(void)
//{

//  printk("yes\n");
//  sys_call_table[syscall_num] = (int)sys_test;
//  return 0;

//}
//
//void cleanup_module(void)
//{
// sys_call_table[syscall_num] = 0;
//}
//
//#endif /* MODULE */
//
//
//-
//To unsubscribe from this list: send the line "unsubscribe linux-kernel" in //the body of a message to [email protected]
//More majordomo info at http://vger.kernel.org/majordomo-info.html
//Please read the FAQ at http://www.tux.org/lkml/
//

#26 lore raw

Re: How to enable printk

In reply to Wanghong Yuan
Quoted 2 lines · [email protected] said:

It may be a simple question. But I cannot see the result of printk in
console like the following. Do i need to enable it somewhere? Thanks

You didn't give a priority, so it will have defaulted to KERN_WARNING.

Some distributions disable the logging of KERN_WARNING messages to the console, which seems to be a very silly thing to do. I suggest you re-enable these messages (echo 7 > /proc/sys/kernel/printk) and file a bug report.

--
dwmw2

#27 lore raw

Re: How to enable printk

In reply to Wanghong Yuan
Quoted 8 lines · David Woodhouse
Quoted 2 lines · [email protected] said:

It may be a simple question. But I cannot see the result of printk in
console like the following. Do i need to enable it somewhere? Thanks

You didn't give a priority, so it will have defaulted to KERN_WARNING.

Some distributions disable the logging of KERN_WARNING messages to the console, which seems to be a very silly thing to do.

It is not silly as long as kernel continues to log tons of normal stuff as warnings.

Quoted 1 line

file a bug report.

Here it is:
There are way too many printks without a log level! --
vda

#28 lore raw

Re: How to enable printk

Quoted 2 lines · [email protected] said:

It is not silly as long as kernel continues to log tons of normal
stuff as warnings.

Er, IMO it _is_ silly as long as the kernel continues to log real warnings as warnings too.

Quoted 1 line

Here it is: There are way too many printks without a log level! --

Oh, well the answer is obvious - just disable _all_ the warning messages.

Why not turn off KERN_CRIT too, while we're at it? I'm sure we can find at least one superfluous KERN_CRIT message.

--
dwmw2

#29 lore raw

Re: How to enable printk

In reply to Denis Vlasenko
Quoted 7 lines · David Woodhouse
Quoted 2 lines · [email protected] said:

It is not silly as long as kernel continues to log tons of normal
stuff as warnings.

Er, IMO it _is_ silly as long as the kernel continues to log real warnings as warnings too.

Quoted 6 lines
Quoted 1 line

Here it is: There are way too many printks without a log level! --

Oh, well the answer is obvious - just disable _all_ the warning messages.

Why not turn off KERN_CRIT too, while we're at it? I'm sure we can find at least one superfluous KERN_CRIT message.

Hey, hey... do you expect users to patch all those printk() calls in their kernel themself? Realistically they can:

* enable console logging for warnings and be flooded
* disable console logging for warnings and stay blind
* send patches to lkml and be ignored
* configure syslogd to print warnings on a dedicated tty

Anyway, that's what I did.
--
vda

#30 lore raw

Re: How to enable printk

Quoted 2 lines · [email protected] said:

Hey, hey... do you expect users to patch all those printk() calls in
their kernel themself? Realistically they can:

I was talking about vendors setting silly defaults. One can reasonably expect _vendors_ to fix printks with wrong or no priority rather than just disabling them all.

There's a lot of crap at KERN_NOTICE that could be sanely ignored by default. Stuff at KERN_WARNING probably ought to be printed by default. It can often precede and explain a crash.

Quoted 1 line

* send patches to lkml and be ignored

There are more sensible places to send patches than lkml.

--
dwmw2

#31 lore raw

Re: How to enable printk

In reply to David S. Miller
Quoted 5 lines · Wanghong Yuan

Hi,

It may be a simple question. But I cannot see the result of printk in console like the following. Do i need to enable it somewhere? Thanks

man dmesg

The manual is not explicit about valid values for the logging level. Try "dmesg -n8".

-- Itai

#32 lore raw

Re: How to enable printk

In reply to David S. Miller
Quoted 4 lines · * Wanghong Yuan ([email protected]) wrote:

Hi,

It may be a simple question. But I cannot see the result of printk in console like the following. Do i need to enable it somewhere? Thanks

Take a look a man 8 dmesg. Also Documentation/sysctl/kernel.txt.

Quoted 11 lines

/*-O2 -Wall -DMODULE -D__KERNEL__ -DLINUX -c testsys.c */

#include <linux/sys.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <sys/syscall.h>
#include <asm/uaccess.h>

Quoted 2 lines

/* The system call number we attempt to install ourselves as. */ static int syscall_num = 165;

I hope you know this can't be done safely (race free).

Quoted 19 lines

asmlinkage int sys_test(int pid, int period, int cycles, int* ptr)

{

put_user(current->pid, ptr);
return pid-10000;

}

extern int sys_call_table[];

#ifdef MODULE
int init_module(void)
{
printk("yes\n");
sys_call_table[syscall_num] = (int)sys_test;
return 0;
}

Quoted 3 lines

void cleanup_module(void)
{
sys_call_table[syscall_num] = 0;

this could cause a problem. you should save the original entry when you insmod and restore it here ;-)

Quoted 3 lines

}

#endif /* MODULE */

btw, take a look at how the module_init() and module_exit() macros are used in the kernel.

hope that helps,
-chris

#33 lore raw

Accurately measure CPU cycles used by a program? thanks

In reply to David S. Miller

Is there any package or program, which can be used to accurately measure the CPU cycles used by a program? I think the following code can only provide an inaccurate one, beause it may count on the waiting time of the program.

gettimeofday(t1)
runprogam
gettimeofday(t2)
t2-t1

If I need to instrument the kernel, which part I should investigate? Thanks a lot in advance

Wanghong

#34 lore raw

what replaces tq_scheduler in 2.4

In reply to David S. Miller

Hi,

It seems that tq_scheduler disappears in Linux 2.4. SO what can I do if I need to do something when the scheduler wakes up. The old code likes

queue_task(&myqueue, &tq_scheduler);

Thanks

#35 lore raw

Re: what replaces tq_scheduler in 2.4

In reply to David S. Miller
Quoted 6 lines · Wanghong Yuan

Hi,

It seems that tq_scheduler disappears in Linux 2.4. SO what can I do if I need to do something when the scheduler wakes up. The old code likes

All users of tq_scheduler were using it as a way of running process-context code shortly after the occurrence of an interrupt. They were moved over to using schedule_task(). Probably, that is what you want.

If you specifically have a need to know when the scheduler is entered then there is no longer a way of doing that.

-

#36 lore raw

suspend a thread in LKM

In reply to David S. Miller

Hi,

I am currently working a scheduling algorithm, implemented with a LKM. The basic probelm is to control a thread (user-level) to run for x time units every y. After x, it should wait until next y.

My current problem is that how can I let the thread wait (sleep) until next y? I think I should put the thread in a unrunable state, and then enable it when next y comes. But how?

Thanks alot in advance.

w.h.y

#37 lore raw

Re: what replaces tq_scheduler in 2.4

In reply to David S. Miller

Hi Andrew,
hi others,

Quoted 9 lines · Andrew Morton
Quoted 3 lines · Wanghong Yuan

It seems that tq_scheduler disappears in Linux 2.4. SO what can I do if I need to do something when the scheduler wakes up. The old code likes

All users of tq_scheduler were using it as a way of running process-context code shortly after the occurrence of an interrupt. They were moved over to using schedule_task(). Probably, that is what you want.

What is the main difference between tq_immediate and the former tq_scheduler?

I would like to know, whether I can convert my old bh routines[1] to that new mechanism.

Thanks & Regards

Ingo Oeser

[1] Note to German readers: I mean interrupt backends! Nothing else :-)

Signature · 1 line
Science is what we can tell a computer. Art is everything else. --- D.E.Knuth
#38 lore raw

Re: what replaces tq_scheduler in 2.4

In reply to David S. Miller

HI, Ingo

Did you get the answer? Please cc me

Quoted 6 lines

Hi Andrew,
hi others,

Quoted 2 lines · Andrew Morton
Quoted 1 line · Wanghong Yuan

It seems that tq_scheduler disappears in Linux 2.4. SO what can I do

if I

Quoted 14 lines
Quoted 7 lines
Quoted 2 lines

need to do something when the scheduler wakes up. The old code likes

All users of tq_scheduler were using it as a way of running process-context code shortly after the occurrence of an interrupt. They were moved over to using schedule_task(). Probably, that is what you want.

What is the main difference between tq_immediate and the former tq_scheduler?

I would like to know, whether I can convert my old bh routines[1] to that new mechanism.

Quoted 8 lines

Thanks & Regards

Ingo Oeser

[1] Note to German readers: I mean interrupt backends! Nothing else :-)
--
Science is what we can tell a computer. Art is everything else. ---

D.E.Knuth

Quoted 6 lines

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

#39 lore raw

Re: what replaces tq_scheduler in 2.4

In reply to David S. Miller
Quoted 4 lines · Ingo Oeser

...
What is the main difference between tq_immediate and the former tq_scheduler?

tq_immediate looks to be some very old piece of kernel infrastructure which is somewhat obsolete but all the users have not been converted to yet. May run in interrupt context.

tq_scheduler callbacks run in process context. Use schedule_task() instead.

These mechanisms are discussed in the Rubini/Corbet bible:
http://www.xml.com/ldd/chapter/book/

#40 lore raw
In reply to [email protected]
Quoted 10 lines · David S. Miller

From: Ben Greear <[email protected]>
Date: Wed, 24 Apr 2002 10:31:29 -0700

Maybe it could just WARN and still bring it up, if it's just an MTU issue? (Or is this a total failure of VLAN support you are talking about?)

This creates a support issue. It's almost impossible to field bug reports effectively once you start letting users do stuff like this.

We let users do much worse: rm -fr /
won't even warn you. I'm all for warning the user, but since the MTU issue can be worked around by setting the VLAN MTU to 1496, and sometimes setting the eth0 MTU to 1504, then putting hard restrictions in the kernel sounds like a really bad idea.

Quoted 10 lines

Also, is there any good reason that we can't get at least a compile time change into some of the drivers like tulip where we know we can get at least MOST of the cards supported with a small change?

I know the driver writers hate cruft in the drivers, but we have had ppl using the patches in production machines for months, if not years, with no ill effects.

But the changes are wrong, just because they work for some people doesn't make the change mergeable into the main tree.

Wrong is a strong word for a change that makes it work for some people without obvious negative side effects. I can understand not putting the changes in by default, but a module-load flag, or a compile time check is much easier to support than telling the user to go patch their driver and come back when they figure out how to do that... It will also allow users to easily test the patches on all their various systems.

Quoted 5 lines

The same argument applies to the EEPRO driver (we know a cure, but it's a magic register number, and no one will accept the patch).

Intel is making strides with their e1000 and e100 drivers, just give them some time.

That is good news, but does not change my arguments about fixing up the eepro driver at all :)

Quoted 3 lines

Also Jeff is in a rut right and busy with some things, once he gets back up to speed you can expect a lot of these issues to be dealt with.

I'm looking forward to Jeff's return. I still haven't heard if he ever figured out why 3 DFE-570-tx (4-port) tulip nics cannot exist in the same system :)

Ben

Quoted 11 lines

Franks a lot,
David S. Miller
[email protected]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 3 lines
Ben Greear <[email protected]>       <Ben_Greear AT excite.com>
President of Candela Technologies Inc      http://www.candelatech.com
ScryMUD:  http://scry.wanfear.com     http://scry.wanfear.com/~greear
#41 lore raw

From: Ben Greear <[email protected]>
Date: Wed, 24 Apr 2002 10:58:06 -0700

Quoted 2 lines

But the changes are wrong, just because they work for some people doesn't make the change mergeable into the main tree.

Wrong is a strong word for a change that makes it work for some people without obvious negative side effects.

Ummm, sed 's/obvious/known/' We don't know what the patch even does.

That is good news, but does not change my arguments about fixing up the eepro driver at all :)

The point is that once we see what works in the e100 driver (and Jeff and I are making them document the bits) we can add the same fix to eepro100.c

Franks a lot,
David S. Miller
[email protected]

#42 lore raw
In reply to Ben Greear
Quoted 8 lines

Von: <[email protected]>
Gesendet: 24.04.2002 20:00

Quoted 3 lines

This creates a support issue. It's almost impossible to field bug reports effectively once you start letting users do stuff like this.

We let users do much worse: rm -fr /
won't even warn you.

But it would do, what we expect. VLAN on a e.g. unpatched tulip driver is somewhat unpredictable. You can hope any application is using small packets, but if not things get worse.

Quoted 4 lines

I'm all for warning the user, but since the
MTU issue can be worked around by setting the VLAN MTU to 1496, and sometimes setting the eth0 MTU to 1504, then putting hard restrictions in the kernel sounds like a really bad idea.

This sounds very "experimental". What about the non-VLAN packets on eth0, when you set the MTU 1504?

I like the NETIF_F_VLAN_CHALLENGED capability in the driver itself, which is then tested by the net subsystem on creation of a VLAN. No more tweaks and fiddling around with MTU and framesizes.

Greetings

Jochen Dolze

#43 lore raw
In reply to David S. Miller
Quoted 7 lines · David S. Miller
   From: [email protected]
   Date: Wed, 24 Apr 2002 19:03:19 +0200

   Oh. Even in 2.4 ?

Yes, the "cannot do VLAN" flag is there in 2.4.x

Quoted 7 lines

That's a good idea. So vconfig could check, if its possible to create a VLAN on top of such a driver - and issue a message if not.

VLAN layer checks this and fails to bring up VLAN if flag is set for the device being configured. I'm way ahead of you.

Maybe it could just WARN and still bring it up, if it's just an MTU issue? (Or is this a total failure of VLAN support you are talking about?)

Also, is there any good reason that we can't get at least a compile time change into some of the drivers like tulip where we know we can get at least MOST of the cards supported with a small change?

I know the driver writers hate cruft in the drivers, but we have had ppl using the patches in production machines for months, if not years, with no ill effects.

The same argument applies to the EEPRO driver (we know a cure, but it's a magic register number, and no one will accept the patch).

Ben

Quoted 11 lines

Franks a lot,
David S. Miller
[email protected]
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 3 lines
Ben Greear <[email protected]>       <Ben_Greear AT excite.com>
President of Candela Technologies Inc      http://www.candelatech.com
ScryMUD:  http://scry.wanfear.com     http://scry.wanfear.com/~greear
#44 lore raw

From: Ben Greear <[email protected]>
Date: Wed, 24 Apr 2002 10:31:29 -0700

Maybe it could just WARN and still bring it up, if it's just an MTU issue? (Or is this a total failure of VLAN support you are talking about?)

This creates a support issue. It's almost impossible to field bug reports effectively once you start letting users do stuff like this.

Also, is there any good reason that we can't get at least a compile time change into some of the drivers like tulip where we know we can get at least MOST of the cards supported with a small change?

I know the driver writers hate cruft in the drivers, but we have had ppl using the patches in production machines for months, if not years, with no ill effects.

But the changes are wrong, just because they work for some people doesn't make the change mergeable into the main tree.

The same argument applies to the EEPRO driver (we know a cure, but it's a magic register number, and no one will accept the patch).

Intel is making strides with their e1000 and e100 drivers, just give them some time.

Also Jeff is in a rut right and busy with some things, once he gets back up to speed you can expect a lot of these issues to be dealt with.

Franks a lot,
David S. Miller
[email protected]

#45 lore raw
In reply to Ben Greear
Quoted 11 lines · David S. Miller

From: Ben Greear <[email protected]>
Date: Wed, 24 Apr 2002 10:58:06 -0700

Quoted 2 lines

But the changes are wrong, just because they work for some people doesn't make the change mergeable into the main tree.

Wrong is a strong word for a change that makes it work for some people without obvious negative side effects.

Ummm, sed 's/obvious/known/' We don't know what the patch even does.

We may not know EVERYTHING the patch does, but we do know that it enables VLANs to work, and does not degrade other functionality in any _observable_ way (to this point in time, at least.)

If someone wants to use VLANS, and wants to use EEPRO nics, then this patch is obviously better than the unpatched driver. Thus my suggestion that we make it easier for users to enable this patch/hack/whatever.

Allowing a #define switch, or even clearly commented driver code that a FAQ can point to will help the VLAN user, and will not AT ALL affect non-vlan aware users.

If/when the e100 guys show us a better way, no one will argue that you shouldn't modify the eepro100 to be more kosher.

Thanks,
Ben

Signature · 3 lines
Ben Greear <[email protected]>       <Ben_Greear AT excite.com>
President of Candela Technologies Inc      http://www.candelatech.com
ScryMUD:  http://scry.wanfear.com     http://scry.wanfear.com/~greear
#46 lore raw
In reply to David S. Miller
Quoted 3 lines · Ben Greear

Also, is there any good reason that we can't get at least a compile time change into some of the drivers like tulip where we know we can get at least MOST of the cards supported with a small change?

The tulip patch is butt-ugly - the oversized allocation isn't needed, and it just flat-out turns off large packet protection. That's really not what you want to do, even for the best tulip cards. If an oversized gram (non-VLAN) makes it into a network which such a patched tulip driver, you can DoS. So, I view the current tulip patch as unacceptable too -- for security reasons, we should not even take it as a compile time patch. (and I recommend against using that patch on production machines, for the same security reasons)

The proper tulip patch does not need to change packet allocation size at all (it's already plenty big enough), and it needs to copy the RX fragment handling code from 8139cp (which is admittedly ugly, slow path) or write fresh fragment handling code. Along with that fragment handling code comes a safe way to do VLAN, and non-standard large MTUs in general.

Quoted 2 lines

The same argument applies to the EEPRO driver (we know a cure, but it's a magic register number, and no one will accept the patch).

I think we have a good chance of making that a less magic-number patch, though, given the last discussion.

Jeff

#47 lore raw
In reply to David S. Miller
Quoted 7 lines · Jeff Garzik
Quoted 4 lines · Ben Greear

Also, is there any good reason that we can't get at least a compile time change into some of the drivers like tulip where we know we can get at least MOST of the cards supported with a small change?

Quoted 8 lines

The tulip patch is butt-ugly - the oversized allocation isn't needed, and it just flat-out turns off large packet protection. That's really not what you want to do, even for the best tulip cards. If an oversized gram (non-VLAN) makes it into a network which such a patched tulip driver, you can DoS. So, I view the current tulip patch as unacceptable too -- for security reasons, we should not even take it as a compile time patch. (and I recommend against using that patch on production machines, for the same security reasons)

I can DOS a tulip card with very small packets too ;)

The oversized allocations can be removed from the patch since they are not needed.

Quoted 6 lines

The proper tulip patch does not need to change packet allocation size at all (it's already plenty big enough), and it needs to copy the RX fragment handling code from 8139cp (which is admittedly ugly, slow path) or write fresh fragment handling code. Along with that fragment handling code comes a safe way to do VLAN, and non-standard large MTUs in general.

In the general case, where the packets are only 1518 (ie no DoS or mis-configured hardware is in effect), is there a need for the "ugly, slow path" code to run?

Signature · 3 lines
Ben Greear <[email protected]>       <Ben_Greear AT excite.com>
President of Candela Technologies Inc      http://www.candelatech.com
ScryMUD:  http://scry.wanfear.com     http://scry.wanfear.com/~greear
#48 lore raw
In reply to David S. Miller

On Wed, Apr 24, 2002 at 01:49:33PM -0400, Jeff Garzik wrote:
...

Quoted 5 lines

The tulip patch is butt-ugly - the oversized allocation isn't needed, and it just flat-out turns off large packet protection. That's really not what you want to do, even for the best tulip cards. If an oversized gram (non-VLAN) makes it into a network which such a patched tulip driver, you can DoS.

It all depends... At least the cisco switches I have used have protection by controlling on how large frames you can send, and having automatic enlarging of frame size for VLAN Trunking port.

Of course those switches have some amounts of "jumbogram support" as well at port by port basis.

So perhaps you can DoS your machine off the net (or your stream very least), but not other machines.

Quoted 1 line

Jeff

/Matti Aarnio

#49 lore raw
In reply to David S. Miller
Quoted 19 lines · Ben Greear
Quoted 7 lines · Jeff Garzik
Quoted 4 lines · Ben Greear

Also, is there any good reason that we can't get at least a compile time change into some of the drivers like tulip where we know we can get at least MOST of the cards supported with a small change?

Quoted 8 lines

The tulip patch is butt-ugly - the oversized allocation isn't needed, and it just flat-out turns off large packet protection. That's really not what you want to do, even for the best tulip cards. If an oversized gram (non-VLAN) makes it into a network which such a patched tulip driver, you can DoS. So, I view the current tulip patch as unacceptable too -- for security reasons, we should not even take it as a compile time patch. (and I recommend against using that patch on production machines, for the same security reasons)

Quoted 1 line

I can DOS a tulip card with very small packets too ;)

A tulip card? Or the stack?

Can you DoS it when CONFIG_NET_HW_FLOWCONTROL is enabled? That's basically NAPI without the fancy acronym...

Quoted 9 lines
Quoted 6 lines

The proper tulip patch does not need to change packet allocation size at all (it's already plenty big enough), and it needs to copy the RX fragment handling code from 8139cp (which is admittedly ugly, slow path) or write fresh fragment handling code. Along with that fragment handling code comes a safe way to do VLAN, and non-standard large MTUs in general.

In the general case, where the packets are only 1518 (ie no DoS or mis-configured hardware is in effect), is there a need for the "ugly, slow path" code to run?

It depends on the chip, but most generally: no

Jeff

#50 lore raw
In reply to David S. Miller
Quoted 12 lines · Matti Aarnio

On Wed, Apr 24, 2002 at 01:49:33PM -0400, Jeff Garzik wrote:
...

Quoted 5 lines

The tulip patch is butt-ugly - the oversized allocation isn't needed, and it just flat-out turns off large packet protection. That's really not what you want to do, even for the best tulip cards. If an oversized gram (non-VLAN) makes it into a network which such a patched tulip driver, you can DoS.

It all depends... At least the cisco switches I have used have protection by controlling on how large frames you can send, and having automatic enlarging of frame size for VLAN Trunking port.

Quoted 5 lines

Of course those switches have some amounts of "jumbogram support" as well at port by port basis.

So perhaps you can DoS your machine off the net (or your stream very least), but not other machines.

The DoS certainly assumes that one can send jumbo datagrams to the target machine via a local network. There are a multitude of ways one can prevent the DoS present in the tulip VLAN patch, what you name is certainly one of them.

Jeff

#51 lore raw
In reply to David S. Miller
Quoted 6 lines · David S. Miller
   From: [email protected]
   Date: Wed, 24 Apr 2002 19:03:19 +0200

   Oh. Even in 2.4 ?

Yes, the "cannot do VLAN" flag is there in 2.4.x

Is there an up-to-date list of hardware and/or drivers that support VLAN with Linux 2.4?

Signature · 1 line
Matthias Andree
#52 lore raw
In reply to [email protected]

Some drivers work, more are being fixed. Others have to be patched. All work if you set the MTU of the link to 1496.

We can use testing of patched drivers, so if you do patch any and have good results, then let us know and the driver changes might get pushed into the kernel sooner.

Ben

Quoted 17 lines · [email protected] wrote:

Hi,

why is a there a experimental VLAN option in the stable 2.4.x-kernel, when it's useless without patching Network Drivers?

Why isn't there a solution for all network drivers to accept frames 4 bytes longer on request of e.g. vconfig (like ifconfig setting promiscious mode on/off) ? Or to deny vconfig to add a vlan, if the network driver/hardware doesn't support this?

Today the situation is as follows: The experimental VLAN-option is useless, if i dont patch my network drivers, otherwise there is no working VLAN function.

Any future plans?

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Signature · 3 lines
Ben Greear <[email protected]>       <Ben_Greear AT excite.com>
President of Candela Technologies Inc      http://www.candelatech.com
ScryMUD:  http://scry.wanfear.com     http://scry.wanfear.com/~greear
#53 lore raw
Quoted 4 lines

Von: <[email protected]>
Gesendet: 24.04.2002 18:20
Some drivers work, more are being fixed. Others have to be patched. All work if you set the MTU of the link to 1496.

I made some tests with Windows2000. I have to set the MTU manually (in the registry) to 1496 to get all working. Thats ok for a few clients, but not for many.

Quoted 3 lines

We can use testing of patched drivers, so if you do patch any and have good results, then let us know and the driver changes might get pushed into the kernel sooner.

I don't use a kernel driver, i use a driver from a manufacturer. ZNYX provides some with Source, but i'm not the nic-register-voodoo-man to allow this driver to receive larger frames. I just changed some defines, but this doesn't work.

I use the ZNYX driver cause i didn't got Jeffs Tulip driver to work correctly with my card (346Q). Maybe the tulip driver works better now, but this is not the point.

The point is that i get no information if VLAN works with a nic/driver (including third party drivers) without MTU limitations.

There should really be a flag, a tag or a capability thing in the driver which says "VLAN not possible", when vconfig tries to add a VLAN. So if i get a third party driver, vconfig would report if i can use it or not.

Today i have to test it with every nic/driver - not so nice. But think of others, who are not so involved in networking things, they setup a vlan like you (and e.g. Cisco or 3COM) described and get problems with ftp, large pings, etc. pp.