All of lore.kernel.org
 help / color / mirror / Atom feed
* [Adeos-main] LRTBF par-log.c & adeos_critical_enter question
@ 2005-07-11 14:05 Hannes Mayer
  0 siblings, 0 replies; only message in thread
From: Hannes Mayer @ 2005-07-11 14:05 UTC (permalink / raw)
  To: adeos-main

Hi all! (Philippe? Kristian? :-)

Over the weekend I was pondering over the LRTBF par-log.c example and used
the circular buffer for one of my own examples:

One question arose - which actually causes a problem too:

In par-log.c in read_proc: why do you set disable_timer ?

In read_proc there is the while loop:

	flags = adeos_critical_enter (NULL);
	while (read_pos != write_pos && len <= (count - MAX_STR_LEN )) {
	[...]
	}
	adeos_critical_exit (flags);

After adeos_critical_enter, interrupts are disabled anyway (right?), so no
modification of read_pos or write_pos is possible and reading over the
proc file is not disturbed.

Furthermore in read_proc you reset disable_timer only after the complete
buffer was read via the proc file:

	if (read_pos == write_pos) {
		disable_timer = 0;

The problem:
While some user-space app is reading from the proc file, nothing is written
to the buffer and this causes data loss.

IMO, it would be best, if writing to the buffer is not disabled in read_proc.
In the actual data copying action in read_proc/while-loop no interrupt can
interfer - and if not everything from the buffer was read in the first place,
there is no problem if some data is added to the buffer until the next read
action occurs.

Maybe I'm overlooking something here - thanks for any comments and help! :-)

Best regards,
Hannes.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-07-11 14:05 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-11 14:05 [Adeos-main] LRTBF par-log.c & adeos_critical_enter question Hannes Mayer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.