Skip to contentSkip to conversation

Re: [Fwd: Bug: 2.2.12 still hangs PPC after some PPP activity]

Fwd: Bug: 2.2.12 still hangs PPC after some PPP activity Geert Uytterhoeven 7 participants 29 messages Sep 29, 1999 – Oct 12, 1999 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 1 line · Lou Langholtz

What might happen if a driver does:

point A

Quoted 6 lines

save_flags(old_flags);
cli();
restore_flags(old_flags);
save_flags(new_flags);
cli();
restore_flags(new_flags);

point B

Quoted 2 lines

/* can't we be interupted here? Assume yes, if so */ restore_flags(old_flags);

point C

Quoted 10 lines

seems like this might introduce a bug if we could get interrupted after the restore of the new_flags but before the second restore of old flags in such a way such that the proper state of old_flags could change. I'm not comfortable enough though with my understanding of interrupts and driver routines to be certain one way or another. To be more specific, consider the case on just a single processor system. If this strikes anyone else as a possible race condition that could introduce a bug, then this is what we need to fix in macserial.c's rs_write routine since this code can potentially happen.

Opinions??? Please clue me in anyway... this stuff's a kick! :-)

The interrupt mask register has the same contents at points A, B and C. Hence, if we could be interrupt a point A, we can be interrupt at points B and C.

Greetings,

Geert

--
Geert Uytterhoeven ----------------- Sony Suprastructure Center Europe (SUPC-E) [email protected] ------------------- Sint Stevens Woluwestraat 55 Phone +32-2-7248648 Fax +32-2-7262686 ---------------- B-1130 Brussels, Belgium

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#2 lore raw
In reply to a message not in the archive
Quoted 11 lines · Lou Langholtz

What might happen if a driver does:

save_flags(old_flags);
cli();
restore_flags(old_flags); save_flags(new_flags);
cli();
restore_flags(new_flags);
/* can't we be interupted here? Assume yes, if so */ restore_flags(old_flags);

Quoted 8 lines

seems like this might introduce a bug if we could get interrupted after the restore of the new_flags but before the second restore of old flags in such a way such that the proper state of old_flags could change. I'm not comfortable enough though with my understanding of interrupts and driver routines to be certain one way or another. To be more specific, consider the case on just a single processor system. If this strikes anyone else as a possible race condition that could introduce a bug, then this is what we need to fix in macserial.c's rs_write routine since this code can potentially happen.

I'm fairly certain it's a bug. Good spotting. The last restore_flags() shouldn't be there.

macserial.c renamed from macserial.c.ORIG +0 -1
@@ -1381,7 +1381,6 @@
 	if (info->xmit_cnt && !tty->stopped && !info->tx_stopped
 	    && !info->tx_active)
 		transmit_chars(info);
-	restore_flags(flags);
 	return ret;
 }
 

Takashi Oe

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#3 lore raw
Quoted 21 lines · Takashi Oe
Quoted 11 lines · Lou Langholtz

What might happen if a driver does:

save_flags(old_flags);
cli();
restore_flags(old_flags); save_flags(new_flags);
cli();
restore_flags(new_flags);
/* can't we be interupted here? Assume yes, if so */ restore_flags(old_flags);

Quoted 8 lines

seems like this might introduce a bug if we could get interrupted after the restore of the new_flags but before the second restore of old flags in such a way such that the proper state of old_flags could change. I'm not comfortable enough though with my understanding of interrupts and driver routines to be certain one way or another. To be more specific, consider the case on just a single processor system. If this strikes anyone else as a possible race condition that could introduce a bug, then this is what we need to fix in macserial.c's rs_write routine since this code can potentially happen.

Quoted 2 lines

I'm fairly certain it's a bug. Good spotting. The last restore_flags() shouldn't be there.

Or one of the others. The last restore_flags() may make me think there's something wrong, but it cannot cause harm. If there's a real bug, it should be related to the other flag manipulation calls.

Greetings,

Geert

--
Geert Uytterhoeven ----------------- Sony Suprastructure Center Europe (SUPC-E) [email protected] ------------------- Sint Stevens Woluwestraat 55 Phone +32-2-7248648 Fax +32-2-7262686 ---------------- B-1130 Brussels, Belgium

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#4 lore raw
In reply to Takashi Oe

macserial.c line 1385

Quoted 12 lines · Takashi Oe

I'm fairly certain it's a bug. Good spotting. The last restore_flags() shouldn't be there.

macserial.c renamed from macserial.c.ORIG +0 -1
@@ -1381,7 +1381,6 @@
 	if (info->xmit_cnt && !tty->stopped && !info->tx_stopped
 	    && !info->tx_active)
 		transmit_chars(info);
-	restore_flags(flags);
 	return ret;
 }

This doesn't look like the only problem. For example, in rs_close, we call tty_wait_until_sent with interrupt disabled. Can't this cause a deadlock ? There may be other cases like this.

I'll look into adding some fixes and include them in the next kernel I post on my page (along with a few other stuffs I'd want to get tested, including your page_alloc() fix which _apparently_ increased the overall perfs on my machine but I didn't do real benchmarks). But I'm wondering if we shouldn't include your DMA driver right now and make sure it works fine instead of doing yet another bunch of patches to the current macserial. I didn't try the DMA driver yet, are there known problems with it ?

I'll try to make 2.3.x versions of my various patches if I find some time this week (may have to wait next week end).

On another issue: Is there someone with a 3400 and this famous interrupt-less ethernet combo out there who knows how to hack into pmac_pic.c ? I have managed to get the interrupt working with an horrible hack in de4x5.c, and I'm trying to implement a clean version with a cascaded controller the way I did if for gatwick on the wallstreet. Unfortuntately, the clean version doesn't work yet, I don't have one of those machine to test, and my remote-tester was not able (or didn't have time) to find out what's going on with the clean version. Any volunteer ?

Signature · 6 lines
           Perso. e-mail: <mailto:[email protected]>
           Work   e-mail: <mailto:[email protected]>
BenH.      Web   : <http://calvaweb.calvacom.fr/bh40/>


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
#5 lore raw
Quoted 8 lines · Benjamin Herrenschmidt

This doesn't look like the only problem. For example, in rs_close, we call tty_wait_until_sent with interrupt disabled. Can't this cause a deadlock ? There may be other cases like this.

I'll look into adding some fixes and include them in the next kernel I post on my page (along with a few other stuffs I'd want to get tested, including your page_alloc() fix which _apparently_ increased the overall perfs on my machine but I didn't do real benchmarks). But I'm wondering

The __get_free_pages() fix is probably not needed for 2.2.13pre, although something similar might save a few hundred cycles. Anyway, much to my amazement, there is significant differences in a number of errors ppp link report between the kernels with and without the __get_free_pages() patch. With a stock 2.2.12 kernel, ppp link used to report 1 to 10% frame errors. But, now, it hardly ever reports any error. Besides, my machine hasn't crashed for two days. I can't remember the last time that my machine stayed up so long.

Quoted 3 lines

if we shouldn't include your DMA driver right now and make sure it works fine instead of doing yet another bunch of patches to the current macserial. I didn't try the DMA driver yet, are there known problems with it ?

I don't know of any major flaw, but the DMA code can use some testings. I've only tested it on Power Mac 7600 with baud rate of upto 115200 bps.

Takashi Oe

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#6 lore raw
Quoted 2 lines · Takashi Oe

I don't know of any major flaw, but the DMA code can use some testings. I've only tested it on Power Mac 7600 with baud rate of upto 115200 bps.

I've heard of various possible issues with DMA hardware on the serial ports and G3 macs. There seem to be a problem with the Heathrow generation of Apple ASICs. (This was reported to me by people who made a special device that was plugged into those ports, with a custom driver under MacOS). They told me some characters end up beeing garbled when reaching the SCC. I'll do some testings with your driver and my powerbook's internal modem this week end to see if this problem actually occurs or not.

Signature · 6 lines
           Perso. e-mail: <mailto:[email protected]>
           Work   e-mail: <mailto:[email protected]>
BenH.      Web   : <http://calvaweb.calvacom.fr/bh40/>


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
#7 lore raw
Quoted 8 lines · Benjamin Herrenschmidt

I've heard of various possible issues with DMA hardware on the serial ports and G3 macs. There seem to be a problem with the Heathrow generation of Apple ASICs. (This was reported to me by people who made a special device that was plugged into those ports, with a custom driver under MacOS). They told me some characters end up beeing garbled when reaching the SCC. I'll do some testings with your driver and my powerbook's internal modem this week end to see if this problem actually occurs or not.

I suppose that can happen if DBDMA's FIFO wasn't flushed properly for some reason. Do you know if the problem occurs on receiving side (from SCC to DMA) or transmitting side (from DMA to SCC)? How many chars were garbled? If the FIFO were the cause of the problem, the number should be between 1 and 7.

Takashi Oe

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#8 lore raw
Quoted 5 lines · Takashi Oe

I suppose that can happen if DBDMA's FIFO wasn't flushed properly for some reason. Do you know if the problem occurs on receiving side (from SCC to DMA) or transmitting side (from DMA to SCC)? How many chars were garbled? If the FIFO were the cause of the problem, the number should be between 1 and 7.

I don't know the details, it was quite a long time ago... I'll ask him again.

Signature · 6 lines
           Perso. e-mail: <mailto:[email protected]>
           Work   e-mail: <mailto:[email protected]>
BenH.      Web   : <http://calvaweb.calvacom.fr/bh40/>


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
#9 lore raw

update on macserial/DMA

Hi,

I re-wrote the serial DMA support code today and put the patch against samba/vger linux-2.2.12 source trees (as of tonight) at ftp://ppc.linux.or.jp/pub/users/toe/serial/.
I think the patch includes most of macserial patches (Ben's and Lou's are in there, for sure) that I know of.

This code is much better than the previous one in which it was fairly easy to cause frame/overrun errors, although it was far better than the vanila macserial (w/o DMA support). To get a feeling of the driver's performance, I tried the following operations while downloading 10 MB+ files at 49 kbps receiving/33.6 kbps transmitting modem<->ISP and 115 kbps PMac<->modem (ftp on ppp link):

A: "dd if=/dev/zero of=400MB count=409600 bs=1024; cp 400MB /tmp; rm 400MB"
B: planb+xawtv in grabdisplay mode (~10 fps, 640x480x4 bytes/frame)

With vanila macserial:
"A": ~200 overrun errors; ftp transfers were all aborted.

With previous DMA code:
"A": ~20 frame errors per ~600 packets
"B": a few frame errors per ~50 packets
"A+B": ~30 frame errors and a few overrun errors per ~600 packets

With this new DMA code:
"A" or "B" or "A+B": no error has been observed after about an hour of trials (I did see a few frame errors when pppd started up once.)

These trials are pretty subjective, but I'm at least glad that it passed all the tests I tried.

Takashi Oe

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#10 lore raw

Re: update on macserial/DMA

Quoted 7 lines · Takashi Oe

Hi,

I re-wrote the serial DMA support code today and put the patch against samba/vger linux-2.2.12 source trees (as of tonight) at ftp://ppc.linux.or.jp/pub/users/toe/serial/.
I think the patch includes most of macserial patches (Ben's and Lou's are in there, for sure) that I know of.

It breaks (crash) on the wallstreet's internal modem. The reason is that this machines has two SCCs (4 channels) but the device tree only declares channel A on the second SCC (so we have only 3 channels visible). This breaks the channel cross-references you use to access channel B's registers. I'll try to make a simple fix if I find some time today and I think I'll just rewrite the probe code by the end of the week or next week end since it's too much dependent on the device tree layout.

BTW. Paul: The patches on my test page (url below + .../test.html) include among other things support for the PowerBooks 3400/3500 ethernet/modem combo interrupt. It looks like there is a second ohare chip with cascaded interrupt controller either in the combo itself or on the motherboard (or a chip that mimmics the ohare chip). It's not referenced by name in the device tree but by vendorid/deviceid. I'm wondering if it might contains also an SCC cell for the modem but I can't test, I don't have access to one of those machines. I think you have a 3400, don't you ? I'll make sure my new probe code can easily be used to declare SCC cells for this kind of cases (but just passing the addresses in) just in case...

Signature · 6 lines
           Perso. e-mail: <mailto:[email protected]>
           Work   e-mail: <mailto:[email protected]>
BenH.      Web   : <http://calvaweb.calvacom.fr/bh40/>


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
#11 lore raw

Re: update on macserial/DMA

Quoted 3 lines · Benjamin Herrenschmidt

It breaks (crash) on the wallstreet's internal modem. The reason is that this machines has two SCCs (4 channels) but the device tree only declares channel A on the second SCC (so we have only 3 channels visible). This

I see. That would be a problem.

Quoted 4 lines

breaks the channel cross-references you use to access channel B's registers. I'll try to make a simple fix if I find some time today and I think I'll just rewrite the probe code by the end of the week or next week end since it's too much dependent on the device tree layout.

I've just tried your fix, and, as expected, it causes no harm for PMac 7600. Thanks. It's not a big problem, but I think we don't want the "fake" channel to take up "/dev/ttyS3" or such in case another serial driver is to be used concurrently.

Quoted 10 lines

BTW. Paul: The patches on my test page (url below + .../test.html) include among other things support for the PowerBooks 3400/3500 ethernet/modem combo interrupt. It looks like there is a second ohare chip with cascaded interrupt controller either in the combo itself or on the motherboard (or a chip that mimmics the ohare chip). It's not referenced by name in the device tree but by vendorid/deviceid. I'm wondering if it might contains also an SCC cell for the modem but I can't test, I don't have access to one of those machines. I think you have a 3400, don't you ? I'll make sure my new probe code can easily be used to

I think ehternet/modem combo is only for the US model of PowerBook 3400/3500. If Paul had it, the combo should be working a long ago. :)

Quoted 3 lines

declare SCC cells for this kind of cases (but just passing the addresses in) just in case...

Takashi Oe

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#12 lore raw

Re: update on macserial/DMA

Quoted 4 lines · Takashi Oe

I've just tried your fix, and, as expected, it causes no harm for PMac 7600. Thanks. It's not a big problem, but I think we don't want the "fake" channel to take up "/dev/ttyS3" or such in case another serial driver is to be used concurrently.

I beleive this could be acheived by changing line 2404 to pass zs_channels_found-1. Not pretty but not less than my fix anyway... The fake zs_soft exist only because of the assumption zs_channel[i] matches zs_soft[i], I didn't take time to check if this assumption exist only in the probe code or not. I'll try to do something better next week-end if I find some spare time.

Quoted 2 lines

I think ehternet/modem combo is only for the US model of PowerBook 3400/3500. If Paul had it, the combo should be working a long ago. :)

Yes, you are certainly right ;)

Signature · 6 lines
           Perso. e-mail: <mailto:[email protected]>
           Work   e-mail: <mailto:[email protected]>
BenH.      Web   : <http://calvaweb.calvacom.fr/bh40/>


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
#13 lore raw

Re: update on macserial/DMA

Quoted 6 lines · Benjamin Herrenschmidt

I beleive this could be acheived by changing line 2404 to pass zs_channels_found-1. Not pretty but not less than my fix anyway... The fake zs_soft exist only because of the assumption zs_channel[i] matches zs_soft[i], I didn't take time to check if this assumption exist only in the probe code or not. I'll try to do something better next week-end if I find some spare time.

Of course we must do this only when there's fake channel...

Signature · 6 lines
           Perso. e-mail: <mailto:[email protected]>
           Work   e-mail: <mailto:[email protected]>
BenH.      Web   : <http://calvaweb.calvacom.fr/bh40/>


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
#14 lore raw

Re: update on macserial/DMA

In reply to Takashi Oe
Quoted 7 lines · Takashi Oe

Hi,

I re-wrote the serial DMA support code today and put the patch against samba/vger linux-2.2.12 source trees (as of tonight) at ftp://ppc.linux.or.jp/pub/users/toe/serial/.
I think the patch includes most of macserial patches (Ben's and Lou's are in there, for sure) that I know of. . .

We should probably also clean up the two unneeded buf[64] allocations. These would be at lines 1535 and 1572 in Takashi Oe's macserial.c file. They've been left over for a few rounds now and I don't see how they're needed for anything.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#15 lore raw

Re: update on macserial/DMA

Quoted 10 lines · Lou Langholtz
Quoted 7 lines · Takashi Oe

Hi,

I re-wrote the serial DMA support code today and put the patch against samba/vger linux-2.2.12 source trees (as of tonight) at ftp://ppc.linux.or.jp/pub/users/toe/serial/.
I think the patch includes most of macserial patches (Ben's and Lou's are in there, for sure) that I know of. . .

Quoted 4 lines

We should probably also clean up the two unneeded buf[64] allocations. These would be at lines 1535 and 1572 in Takashi Oe's macserial.c file. They've been left over for a few rounds now and I don't see how they're needed for anything.

Also, I noticed that while others reported the DMA addition resulted in far better TCP/IP over PPP performace, I found no such improvement. The difference seems to be that I've been using the 2.2.12 distribution kernel rather than a vger kernel and I'll guess that it's the memory management change that accounts for this. Anyway, I'm going to see if the imporvement will happen now with AC's 2.2.13pre15 kernel with the assumption that the effective memory management difference is in that. I'm very eager to see the improvements that others have noted! :-)

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

A message that is not in the archive (sent off-list or not yet received): [email protected] br.com

#17 lore raw

Re: update on macserial/DMA

Quoted 7 lines · Takashi Oe

Hi,

I re-wrote the serial DMA support code today and put the patch against samba/vger linux-2.2.12 source trees (as of tonight) at ftp://ppc.linux.or.jp/pub/users/toe/serial/.
I think the patch includes most of macserial patches (Ben's and Lou's are in there, for sure) that I know of.

Wow, this (well, with slight mods for 2.3.18vger) works like a charm for me on my slooow 7200/75. Now heavy disk usage doesn't influence the transfer performance anymore and the error rate is extremely low. This patch should be added to the kernel sources ASAP IMHO.

Many thanks,
Franz.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#18 lore raw

Re: update on macserial/DMA

Quoted 4 lines · Franz Sirl

Wow, this (well, with slight mods for 2.3.18vger) works like a charm for me on my slooow 7200/75. Now heavy disk usage doesn't influence the transfer performance anymore and the error rate is extremely low. This patch should be added to the kernel sources ASAP IMHO.

Same here - I used to have to run at a port rate of 56k; now I have either 0 or 1 errors/overruns after hours of surfing/downloading at a port rate of 230.4k! (Using Paul's rsync 2.2.12) Thanks a bunch, Takashi!

Thanks,
Peter

Signature · 7 lines
Peter F. Handel          "[The anti-Christ] also forced everyone, small and
[email protected]      great ... to receive a mark [smart card?] on his
www.cise.ufl.edu/~phandel right hand or on his forehead, so that no one could
FAX: (561) 619-8051       buy or sell unless he had the mark"-Revelation13:16


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
#19 lore raw
In reply to Takashi Oe
Quoted 8 lines · Takashi Oe
Quoted 5 lines · Benjamin Herrenschmidt

. . .
I'll look into adding some fixes and include them in the next kernel I post on my page (along with a few other stuffs I'd want to get tested, including your page_alloc() fix which _apparently_ increased the overall perfs on my machine but I didn't do real benchmarks). But I'm wondering

Quoted 8 lines

The __get_free_pages() fix is probably not needed for 2.2.13pre, although something similar might save a few hundred cycles. Anyway, much to my amazement, there is significant differences in a number of errors ppp link report between the kernels with and without the __get_free_pages() patch. With a stock 2.2.12 kernel, ppp link used to report 1 to 10% frame errors. But, now, it hardly ever reports any error. Besides, my machine hasn't crashed for two days. I can't remember the last time that my machine stayed up so long. . .

I'm running AC's 2.2.13pre15 now and still seeing high error rates (17 out of 472 recieved packets). So if it even might just save a few extra cycles it still seems worthwhile to add this __get_free_pages() fix, especially if it might have the chance of getting rid of the high error rates again. I'll try it myself but I suspect you could get it done much faster if this was enough inclination for you ;-)

Also, any idea why this wouldn't be true on for transmit errors? At least on my machine, ifconfig ppp0 always reports zero errors and zero overruns on TX packets. This seems like a good clue I'll have to dig more into :-)

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#20 lore raw
In reply to Takashi Oe
Quoted 23 lines · Takashi Oe
Quoted 1 line

. . . .seems like this might introduce a bug if we could get interrupted after

the

Quoted 7 lines

restore of the new_flags but before the second restore of old flags in such a way such that the proper state of old_flags could change. I'm not comfortable enough though with my understanding of interrupts and driver routines to be certain one way or another. To be more specific, consider the case on just a single processor system. If this strikes anyone else as a possible race condition that could introduce a bug, then this is what we need to fix in macserial.c's rs_write routine since this code can potentially happen.

I'm fairly certain it's a bug. Good spotting. The last restore_flags() shouldn't be there.

macserial.c Wed Sep 29 02:05:31 1999 renamed from macserial.c.ORIG Wed Sep 29 02:05:14 1999 +0 -1
@@ -1381,7 +1381,6 @@
        if (info->xmit_cnt && !tty->stopped && !info->tx_stopped
            && !info->tx_active)
                transmit_chars(info);
-       restore_flags(flags);
        return ret;
 }
 
Quoted 1 line

Takashi Oe

This is pretty much the kernel I'm running now. I haven't had the "FB. overflow" message yet nor system-freeze but I've experienced the TCP slowdown already. Evidence that we've got other problems as well (IMO). It's only been 20 hours or so with new kernel so not enough time for me to feel confident though about these results.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#21 lore raw
Quoted 8 lines · Lou Langholtz

This is pretty much the kernel I'm running now. I haven't had the "FB. overflow"
message yet nor system-freeze but I've experienced the TCP slowdown already. Evidence that we've got other problems as well (IMO). It's only been 20 hours or
so with new kernel so not enough time for me to feel confident though about these
results.

I've added another fix to the kernel on my test page
(http://calvaweb.calvacom.fr/bh40/test.html). It may fix the hang on close. I don't think it will fix anything related to a slowdown however.

Signature · 6 lines
           Perso. e-mail: <mailto:[email protected]>
           Work   e-mail: <mailto:[email protected]>
BenH.      Web   : <http://calvaweb.calvacom.fr/bh40/>


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
#22 lore raw
Quoted 5 lines · Benjamin Herrenschmidt
Quoted 2 lines · Lou Langholtz

This is pretty much the kernel I'm running now. I haven't had the "FB. overflow" message yet nor system-freeze but I've experienced the TCP slowdown

already.

Quoted 8 lines
Quoted 4 lines

Evidence that we've got other problems as well (IMO). It's only been 20 hours or so with new kernel so not enough time for me to feel confident though about

these results.

I've added another fix to the kernel on my test page
(http://calvaweb.calvacom.fr/bh40/test.html). It may fix the hang on close. I don't think it will fix anything related to a slowdown however.

It's interesting to note that you chose to move save_flags(flags) in rs_write() to just before the cli()'s. What was your reasoning? I'm asking so I can get a better understanding of all the implications of this. Most code that I've perused so far now does what you've basically done --- keeps the save_flags() right before the cli()'s. When I chose to just to remove that last restore_flags() I was basing my descision not to move the originall save_flags() on the rs_write() code in drivers/char/serial.c. In the serial.c file they call save_flags() outside of the while loop like the original rs_write() in macserial.c. This would save time by not being constantly re-invoked within the loop of course but then this only works if the flags saved stay valid. That's the part I'm having the most trouble with --- what kind of calls could invalidate the flags that have been saved.

As to the hang-on-close problem, I've never experienced that before nor heard of it. Is it something that you've seen or heard of? Your change makes sense anyway. I'm just being curious in case this might be effecting me in ways I didn't even realize.

Cheers! :-)

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#23 lore raw
In reply to Takashi Oe
Quoted 27 lines · Takashi Oe
Quoted 11 lines · Lou Langholtz

What might happen if a driver does:

save_flags(old_flags);
cli();
restore_flags(old_flags); save_flags(new_flags);
cli();
restore_flags(new_flags);
/* can't we be interupted here? Assume yes, if so */ restore_flags(old_flags);
. . .

I'm fairly certain it's a bug. Good spotting. The last restore_flags() shouldn't be there.

macserial.c Wed Sep 29 02:05:31 1999 renamed from macserial.c.ORIG Wed Sep 29 02:05:14 1999 +0 -1
@@ -1381,7 +1381,6 @@
        if (info->xmit_cnt && !tty->stopped && !info->tx_stopped
            && !info->tx_active)
                transmit_chars(info);
-       restore_flags(flags);
        return ret;
 }
 
Quoted 1 line

Takashi Oe

If this is true, then what about wherever else transmit_chars() is called. There's numerous instances where because transmit_chars() itself goes into a save_flags(); cli(); ...; restore_flags() where we have these nested cli()... restore_flags(). For instance in rs_throttle() transmit_chars() is called while cli()'s already in effect. If the real problem is the nesting of the locks introduced by transmit_chars() then this would also seem to explain the TCP die-off phenomena. Opinions?

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#24 lore raw
In reply to Takashi Oe
Quoted 13 lines · Takashi Oe

. . .I'm fairly certain it's a bug. Good spotting. The last restore_flags() shouldn't be there.

macserial.c Wed Sep 29 02:05:31 1999 renamed from macserial.c.ORIG Wed Sep 29 02:05:14 1999 +0 -1
@@ -1381,7 +1381,6 @@
        if (info->xmit_cnt && !tty->stopped && !info->tx_stopped
            && !info->tx_active)
                transmit_chars(info);
-       restore_flags(flags);
        return ret;
 }
 
Quoted 1 line

Takashi Oe

Bummer...

I just locked up my system and had to reboot. The above change then doesn't seem to fix the system hangs. On the other hand I never did see the "FB. overflow" message at least.

I've been trying to search around HOWTOs and FAQs and mailing lists to get a better idea of wether nesting save_flags(flags); cli(); stuff...; save_flags(new_flags); cli(); restore_flags(new_flags); restore_flags(flags); is ever even ok. Haven't found anything conclusive yet though. Whatever the case, it doesn't seem like it'd be good practice anyhow. All the other serial support C files I've found so far seem to avoid this except for macserial.c.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#25 lore raw
Quoted 9 lines · Lou Langholtz

Bummer...

I just locked up my system and had to reboot. The above change then doesn't seem to fix the system hangs. On the other hand I never did see the "FB. overflow" message at least.

I've been trying to search around HOWTOs and FAQs and mailing lists to get a better idea of wether nesting save_flags(flags); cli(); stuff...; save_flags(new_flags); cli(); restore_flags(new_flags); restore_flags(flags); is

Basically, cli() disables interrupts. If the interrupts are disabled to begin with, it amounts to nothing. So, I think the nesting should cause no harm.

Quoted 4 lines

ever even ok. Haven't found anything conclusive yet though. Whatever the case, it doesn't seem like it'd be good practice anyhow. All the other serial support C files I've found so far seem to avoid this except for macserial.c.

Takashi Oe

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#26 lore raw
In reply to Lou Langholtz
Quoted 23 lines · Lou Langholtz
Quoted 13 lines · Takashi Oe

. . .I'm fairly certain it's a bug. Good spotting. The last restore_flags() shouldn't be there.

macserial.c Wed Sep 29 02:05:31 1999 renamed from macserial.c.ORIG Wed Sep 29 02:05:14 1999 +0 -1
@@ -1381,7 +1381,6 @@
        if (info->xmit_cnt && !tty->stopped && !info->tx_stopped
            && !info->tx_active)
                transmit_chars(info);
-       restore_flags(flags);
        return ret;
 }
 
Quoted 1 line

Takashi Oe

Bummer...

I just locked up my system and had to reboot. The above change then doesn't seem to fix the system hangs. On the other hand I never did see the "FB. overflow" message at least.

Quoted 6 lines

I've been trying to search around HOWTOs and FAQs and mailing lists to get a better idea of wether nesting save_flags(flags); cli(); stuff...; save_flags(new_flags); cli(); restore_flags(new_flags); restore_flags(flags); is ever even ok. Haven't found anything conclusive yet though. Whatever the case, it doesn't seem like it'd be good practice anyhow. All the other serial support C files I've found so far seem to avoid this except for macserial.c.

Nesting save_flags(); cli(); ... restore_flags();' is perfectly legal. That's exactly the reason why save_flags()' and `restore_flags()' were invented!

Normally, to disable interrupts to make sure a critical code section is not interrupted, you do:

    cli();
    ...
    sti();

The problem with this construct is that the sti()' will always re-enable the interrupts, even when they were disabled when the cli()' was called, like in

void func(void)

{
    ...
    cli();
    ...
    sti();
    ...		// interrupts accidentally re-enabled here!
}
    cli();
    ...
    func();
    ...
    sti();

So save_flags()' saves the current interrupt mask, and restore_flags()' restores it. Problem solved by writing:

void func(void)

{
    ...
    save_flags(flags);
    cli();
    ...
    restore_flags(flags);
    ...		// interrupts accidentally re-enabled here!
}

For former AmigaOS programmers: it's a bit like the Disable()/Enable() Exec functions, which allowed nestings:

    int interrupt_disable_cnt = 0;

    void Disable(void)
    {
	cli();
	interrupt_disable_cnt++;

    }

    void Enable(void)
    {
	if (--interrupt_disable_cnt == 0)
	    sti();
    }

Conclusion: use cli()/sti()' when you're 100% sure interrupts were enabled before the cli() was called, and save_flags()/cli()/restore_flags()' when interrupts may be disabled when entering your code.

Greetings,

Geert

--
Geert Uytterhoeven ----------------- Sony Suprastructure Center Europe (SUPC-E) [email protected] ------------------- Sint Stevens Woluwestraat 55 Phone +32-2-7248648 Fax +32-2-7262686 ---------------- B-1130 Brussels, Belgium

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#27 lore raw
In reply to Lou Langholtz
Quoted 3 lines · Lou Langholtz

I just locked up my system and had to reboot. The above change then doesn't seem to fix the system hangs. On the other hand I never did see the "FB. overflow" message at least.

Hmm, in the recent kernels Paul changed the code to only print the FB message once! For me these lockups (I'm using vger nearly unmodified) are gone since quite a while, but I don't really know a reason why. The major specialties on my 7200/75 are:

- disabled syslog's fsync'ing of /var/log/messages (this prevents the amplifying effect of the FB messages)
- all major stuff is compiled with gcc-2.95.2pre

Franz.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#28 lore raw
Quoted 1 line · Franz Sirl

(I'm using vger nearly unmodified)

This is one thing that has been escaping me for quite a while: how do I get a specific version of the vger kernel, and how do I get a list of the versions I can checkout? Following the instructions given on
<http://cvs.on.openprojects.net/> only gives me the current vger development kernel (2.3.X), and not for example the latest 2.2.X kernel (actually, the "kernel" module does seem to exist on cvs.on.openprojects.net; after trying different things, "linux" worked, and gave me a 2.3.X kernel). Reading the CVS man files haven't helped me much either.
Can some kind soul enlighten me on this?

aLViN

Signature · 4 lines
:r .signature


** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
#29 lore raw
Quoted 4 lines · Alvin Brattli
Quoted 1 line · Franz Sirl

(I'm using vger nearly unmodified)

Quoted 9 lines

This is one thing that has been escaping me for quite a while: how do I get a specific version of the vger kernel, and how do I get a list of the versions I can checkout? Following the instructions given on
<http://cvs.on.openprojects.net/> only gives me the current vger development kernel (2.3.X), and not for example the latest 2.2.X kernel (actually, the "kernel" module does seem to exist on cvs.on.openprojects.net; after trying different things, "linux" worked, and gave me a 2.3.X kernel). Reading the CVS man files haven't helped me much either.
Can some kind soul enlighten me on this?

cvs update -dP -rlinux_2_2

Franz.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#30 lore raw
In reply to Franz Sirl
Quoted 11 lines · Franz Sirl
Quoted 4 lines · Lou Langholtz

I just locked up my system and had to reboot. The above change then doesn't seem
to fix the system hangs. On the other hand I never did see the "FB. overflow" message at least.

Hmm, in the recent kernels Paul changed the code to only print the FB message once! For me these lockups (I'm using vger nearly unmodified) are gone since quite a while, but I don't really know a reason why. The major specialties on my 7200/75 are:

Quoted 5 lines

- disabled syslog's fsync'ing of /var/log/messages (this prevents the amplifying effect of the FB messages)
- all major stuff is compiled with gcc-2.95.2pre

Franz.

thats good to hear. you're using a kernel newer than 2.2.12 which has the fixes i've been experimenting with plus others. like only printing the fb overflow message the first time it occurs in the sequence rather than all the time. the overflow may still be occuring but the message wont keep getting printed. this no doubt makes a few things more usable but by itself shouldn't prevent the tcp slow down to nothing over ppp nor the complete lock up. there's also a kernel memory routine that has some ppc specific fixes to it which seems to greatly imprive ppp performance. 2.2.12 still has some sti() calls in macserial.c which look suspicious. the newer code has gotten rid of at least some of those and i'm now running a kernel that has none of those in macserial.c. this seems to be running much better but i haven't run long enough to have a high confidence that that was particularly problematic.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/