Skip to contentSkip to conversation

fuzzy.patch and fuzzy6.patch.ipv6

PATCH Hime Junior 3 participants 4 messages Apr 30, 2003 – May 3, 2003 netfilter

lore
Share & tools
lore
#0 lore raw

Hi Harald :

My comments go along the original message...

----- Original Message -----
From: Harald Welte <[email protected]>
Date: Wed, 30 Apr 2003 17:57:36 +0200
To: Wojciech Sas Cieciwa <[email protected]>
Subject: Re: [PATCH] fuzzy.patch and fuzzy6.patch.ipv6

Quoted 6 lines · Wojciech Sas Cieciwa
Quoted 4 lines

Hi,
This is small patch to fix toruble on PPC with netfilter in module. [Without this compiler generate "unresolved symbols"]

I´m curious about what "unresolved symbols" are those and why,
by changing the VALUE of a symbolic constant,the problem vanishes...

Quoted 1 line

indeed, there is no need for using floating point arithmetics at all.

OK . The floating point instructions are eliminated by applying this patch .

Quoted 4 lines

Hime, would the proposed changes be fine with you (as the original author) ?

In functional terms , there is no difference between the
two pieces of code - the behavior of the controller SHOULD be
the same (in abstract terms).

The only problem is relative to truncation errors...
I don´t have a PPC to do exaustive tests , but
in the simulations that I have made , no discrepancies were detected when computing the final acceptance rates .

=========================================================

	info->acceptance_rate = (u_int8_t) \
		(PAR_LOW * howhigh + PAR_HIGH * howlow);
		(howhigh * PAR_LOW + PAR_HIGH * howlow);

=========================================================

However , when we change

" if (random_number <= 2.55 * info->acceptance_rate) "

by

" if (random_number <= (255 * info->acceptance_rate) / 100) "

we get different results for some (few) values of info->acceptance_rate.

The good news are that the controller still works well and its behavior is basically the same .

So , the patch (if applied , of course) will change the behavior of the controller - in an innocuous way , truly .

My opinion is that the primary reason for the change is very weird - "unresolved symbols" - and the solution is even more strange. Anyway , I suggest additional investigation about this issue .

Thank you very much .

Signature · 3 lines
__________________________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup
#1 lore raw
Quoted 2 lines · Hime Junior

I´m curious about what "unresolved symbols" are those and why,
by changing the VALUE of a symbolic constant,the problem vanishes...

Although I do all my development on PowerPC, I have to admit that I never tested the fuzzy patch.

I suppose the unreslved symbols are with regard to floating point functions that are not provided by the kernel.

Quoted 2 lines

OK . The floating point instructions are eliminated by applying this patch .

exactly. I am not even sure that it was valid to use floating point instructions at all. IIRC, the kernel doesn't save the FPU registers, so if we interrupt an userspace process that uses FPU, we will corrupt it. Not sure whether this is still true, and/or this is only valid within syscall context.

Quoted 4 lines

The only problem is relative to truncation errors...
I don´t have a PPC to do exaustive tests , but in the simulations that I have made , no discrepancies were detected when computing the final acceptance rates .

well, the algorithm is going to produce the same results on any architecture, independent of PPC or not.

Quoted 3 lines

My opinion is that the primary reason for the change is very weird - "unresolved symbols" - and the solution is even more strange. Anyway , I suggest additional investigation about this issue .

I can easily run a test here on my development machine, it's just the lack of time...

Quoted 1 line

Thank you very much .

Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie
#2 lore raw
In reply to Hime Junior
Quoted 13 lines · Hime Junior

Hi Harald :

My comments go along the original message...

----- Original Message -----
From: Harald Welte <[email protected]>
Date: Wed, 30 Apr 2003 17:57:36 +0200
To: Wojciech Sas Cieciwa <[email protected]>
Subject: Re: [PATCH] fuzzy.patch and fuzzy6.patch.ipv6

Quoted 2 lines · Wojciech Sas Cieciwa
Quoted 1 line
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines

Hi,
This is small patch to fix toruble on PPC with netfilter in module. [Without this compiler generate "unresolved symbols"]

I´m curious about what "unresolved symbols" are those and why,
by changing the VALUE of a symbolic constant,the problem vanishes...

They're because of the floating point usage, you won't see them on ix86 because gcc uses native FPU instructions there - silently building incorrect code, but on other architectures gcc uses math emulation library thus generating unresolved symbols.
And yes, using floating point in kernel is The Wrong Thing, kernel does not save FPU state so if you use it in kernel you may harm both kernel and userland.

Quoted 28 lines
Quoted 1 line

indeed, there is no need for using floating point arithmetics at all.

OK . The floating point instructions are eliminated by applying this patch .

Quoted 4 lines

Hime, would the proposed changes be fine with you (as the original author) ?

In functional terms , there is no difference between the
two pieces of code - the behavior of the controller SHOULD be
the same (in abstract terms).

The only problem is relative to truncation errors...
I don´t have a PPC to do exaustive tests , but
in the simulations that I have made , no discrepancies were detected when computing the final acceptance rates .

=========================================================

	info->acceptance_rate = (u_int8_t) \
		(PAR_LOW * howhigh + PAR_HIGH * howlow);
		(howhigh * PAR_LOW + PAR_HIGH * howlow);

=========================================================

However , when we change

Quoted 7 lines

" if (random_number <= 2.55 * info->acceptance_rate) "

by

" if (random_number <= (255 * info->acceptance_rate) / 100) "

we get different results for some (few) values of info->acceptance_rate.

That's the price of not using FPU, there is no way "fixed point" approximations will be as accurate as floting point.

Quoted 2 lines

The good news are that the controller still works well and its behavior is basically the same .

We might promote to info->acceptance_rate to long long just for the calculations, but I seem to remember that some archs have problems with dividing long long numbers in kernel.

Quoted 6 lines

So , the patch (if applied , of course) will change the behavior of the controller - in an innocuous way , truly .

My opinion is that the primary reason for the change is very weird - "unresolved symbols" - and the solution is even more strange. Anyway , I suggest additional investigation about this issue .

The primary reason was to eliminate the usage of FPU from kernel, unresolved symbols is just the effect of this on non-ix86 archs.

I guess Wojciech Cieciwa won't harm me if I say to direct questions to me as I'm the author of this patch ;)

Jan

Signature · 3 lines
Jan Rękorajski            |  ALL SUSPECTS ARE GUILTY. PERIOD!
baggins<at>mimuw.edu.pl   |  OTHERWISE THEY WOULDN'T BE SUSPECTS, WOULD THEY?
BOFH, MANIAC              |                   -- TROOPS by Kevin Rubio
#3 lore raw
Quoted 7 lines · Jan Rekorajski
Quoted 2 lines

I´m curious about what "unresolved symbols" are those and why,
by changing the VALUE of a symbolic constant,the problem vanishes...

They're because of the floating point usage, you won't see them on ix86 because gcc uses native FPU instructions there - silently building incorrect code, but on other architectures gcc uses math emulation library thus generating unresolved symbols.

This is what I was assuming. I think I've seen this happen on PPC before.

Quoted 2 lines

The primary reason was to eliminate the usage of FPU from kernel, unresolved symbols is just the effect of this on non-ix86 archs.

I'll apply the patch now.

Quoted 2 lines

I guess Wojciech Cieciwa won't harm me if I say to direct questions to me as I'm the author of this patch ;)

;) So I'll put your name in the patch-o-matic Author field.

Quoted 3 lines

Jan

Signature · 1 line
Jan R?korajski            |  ALL SUSPECTS ARE GUILTY. PERIOD!
Signature · 5 lines
- Harald Welte <[email protected]>             http://www.netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie