* Fix in eeprom.c
@ 2005-05-19 6:24 Jean Delvare
2005-05-19 6:24 ` Jean Delvare
` (9 more replies)
0 siblings, 10 replies; 11+ messages in thread
From: Jean Delvare @ 2005-05-19 6:24 UTC (permalink / raw)
To: lm-sensors
> what do you think about this fix?
You're correct. Nice catching. I've applied it to our CVS repository.
Will you send a patch to Greg KH for the eeprom driver in Linux 2.6, or
do you want me to do so?
Thanks.
--
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
^ permalink raw reply [flat|nested] 11+ messages in thread
* AW: Fix in eeprom.c
2005-05-19 6:24 Fix in eeprom.c Jean Delvare
2005-05-19 6:24 ` Jean Delvare
@ 2005-05-19 6:24 ` Ralf Rosch
2005-05-19 6:24 ` Mark Studebaker
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Ralf Rosch @ 2005-05-19 6:24 UTC (permalink / raw)
To: lm-sensors
Hi Jean,
currently I'm only working with Linux MIPS 2.4 kernel,
so it would be nice if you could forward the patch for 2.6.
I have seen another problem regarding (MIPS) architecture:
if (!(new_client = kmalloc(sizeof(struct i2c_client) +
sizeof(struct eeprom_data),
GFP_KERNEL))) {
err = -ENOMEM;
goto ERROR0;
}
you request memory for two structures at a time.
The problem is, that the eeprom_data structure is not
aligned on an 8 byte boundary, which catches an
unaligned kernel exception when working on the update_lock semaphore
on our machine (www.cantastic.de)
I would propose that you use two kmalloc() (kfree) for each
individual structure, which solves our problem.
regards
Ralf
> > what do you think about this fix?
>
> You're correct. Nice catching. I've applied it to our CVS repository.
>
> Will you send a patch to Greg KH for the eeprom driver in Linux 2.6, or
> do you want me to do so?
^ permalink raw reply [flat|nested] 11+ messages in thread
* Fix in eeprom.c
2005-05-19 6:24 Fix in eeprom.c Jean Delvare
@ 2005-05-19 6:24 ` Jean Delvare
2005-05-19 6:24 ` AW: " Ralf Rosch
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Jean Delvare @ 2005-05-19 6:24 UTC (permalink / raw)
To: lm-sensors
> I have seen another problem regarding (MIPS) architecture:
> if (!(new_client = kmalloc(sizeof(struct i2c_client) +
> sizeof(struct eeprom_data),
> GFP_KERNEL))) {
> err = -ENOMEM;
> goto ERROR0;
> }
>
> you request memory for two structures at a time.
> The problem is, that the eeprom_data structure is not
> aligned on an 8 byte boundary, which catches an
> unaligned kernel exception when working on the update_lock semaphore
> on our machine (www.cantastic.de)
> I would propose that you use two kmalloc() (kfree) for each
> individual structure, which solves our problem.
This is quite a problem you reveal there. It happens that all our chip
drivers in both CVS and Linux 2.6 use this single memory allocation
method. This suggests that no i2c chip driver (at least coming from the
lm_sensors project) would work on any architecture not supporting
non-aligned memory accesses.
I'm a bit surprised that this would have been uncovered until today.
Greg, I would be interested in your opinion. Should we update all our
chip drivers to have two memory allocations instead of a single one for
this?
Thanks.
--
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Fix in eeprom.c
2005-05-19 6:24 Fix in eeprom.c Jean Delvare
` (2 preceding siblings ...)
2005-05-19 6:24 ` Mark Studebaker
@ 2005-05-19 6:24 ` Greg KH
2005-05-19 6:24 ` AW: " Ralf Rosch
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2005-05-19 6:24 UTC (permalink / raw)
To: lm-sensors
On Tue, Mar 30, 2004 at 08:40:07PM +0200, Jean Delvare wrote:
> Greg, I would be interested in your opinion. Should we update all our
> chip drivers to have two memory allocations instead of a single one for
> this?
Yeah, we probably should :(
thanks,
greg k-h
^ permalink raw reply [flat|nested] 11+ messages in thread
* Fix in eeprom.c
2005-05-19 6:24 Fix in eeprom.c Jean Delvare
2005-05-19 6:24 ` Jean Delvare
2005-05-19 6:24 ` AW: " Ralf Rosch
@ 2005-05-19 6:24 ` Mark Studebaker
2005-05-19 6:24 ` Greg KH
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Mark Studebaker @ 2005-05-19 6:24 UTC (permalink / raw)
To: lm-sensors
agreed
Greg KH wrote:
> On Tue, Mar 30, 2004 at 08:40:07PM +0200, Jean Delvare wrote:
>
>>Greg, I would be interested in your opinion. Should we update all our
>>chip drivers to have two memory allocations instead of a single one for
>>this?
>
>
> Yeah, we probably should :(
>
> thanks,
>
> greg k-h
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Fix in eeprom.c
2005-05-19 6:24 Fix in eeprom.c Jean Delvare
` (6 preceding siblings ...)
2005-05-19 6:24 ` Greg KH
@ 2005-05-19 6:24 ` Jean Delvare
2005-05-19 6:24 ` Jean Delvare
2005-05-19 6:24 ` AW: " Ralf Rosch
9 siblings, 0 replies; 11+ messages in thread
From: Jean Delvare @ 2005-05-19 6:24 UTC (permalink / raw)
To: lm-sensors
> > Greg, I would be interested in your opinion. Should we update all
> > our chip drivers to have two memory allocations instead of a single
> > one for this?
>
> Yeah, we probably should :(
OK... Here we go. I've converted all drivers in our CVS repository to a
new model where we do the two kmallocs separately. I didn't commit it
yet because it's a very important change (47 chip drivers affected). So
I'd appreciate code reviews and tests before I apply it.
The patch is here:
http://jdelvare.net1.nerim.net/sensors/lm_sensors-CVS-separate-mallocs.diff
It applies on latest CVS.
I tested only the eeprom and lm90 drivers so far. Seems to work, but the
changes are error-prone so what it "seems" is hardly enough to be sure
it's correct.
Ralf, can you confirm that the patche solves your memory alignment
problem with the eeprom driver on MIPS?
Thanks.
--
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
^ permalink raw reply [flat|nested] 11+ messages in thread
* AW: Fix in eeprom.c
2005-05-19 6:24 Fix in eeprom.c Jean Delvare
` (3 preceding siblings ...)
2005-05-19 6:24 ` Greg KH
@ 2005-05-19 6:24 ` Ralf Rosch
2005-05-19 6:24 ` Jean Delvare
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Ralf Rosch @ 2005-05-19 6:24 UTC (permalink / raw)
To: lm-sensors
Jean,
I have applied your eeprom.c patch and tested.
Your fix is quite similar to mine and works fine for me.
Thanks
--
Ralf
> -----Ursprungliche Nachricht-----
> Von: ralf@arbeitsgruppe [mailto:ralf@arbeitsgruppe]Im Auftrag von Jean
> Delvare
> Gesendet: Donnerstag, 1. April 2004 23:17
> An: LM Sensors
> Cc: Ralf Roesch; Greg KH
> Betreff: Re: Fix in eeprom.c
>
>
> > > Greg, I would be interested in your opinion. Should we update all
> > > our chip drivers to have two memory allocations instead of a single
> > > one for this?
> >
> > Yeah, we probably should :(
>
> OK... Here we go. I've converted all drivers in our CVS repository to a
> new model where we do the two kmallocs separately. I didn't commit it
> yet because it's a very important change (47 chip drivers affected). So
> I'd appreciate code reviews and tests before I apply it.
>
> The patch is here:
> http://jdelvare.net1.nerim.net/sensors/lm_sensors-CVS-separate-mal
locs.diff
It applies on latest CVS.
I tested only the eeprom and lm90 drivers so far. Seems to work, but the
changes are error-prone so what it "seems" is hardly enough to be sure
it's correct.
Ralf, can you confirm that the patche solves your memory alignment
problem with the eeprom driver on MIPS?
Thanks.
--
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Fix in eeprom.c
2005-05-19 6:24 Fix in eeprom.c Jean Delvare
` (5 preceding siblings ...)
2005-05-19 6:24 ` Jean Delvare
@ 2005-05-19 6:24 ` Greg KH
2005-05-19 6:24 ` Jean Delvare
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2005-05-19 6:24 UTC (permalink / raw)
To: lm-sensors
On Thu, Apr 01, 2004 at 11:16:36PM +0200, Jean Delvare wrote:
> > > Greg, I would be interested in your opinion. Should we update all
> > > our chip drivers to have two memory allocations instead of a single
> > > one for this?
> >
> > Yeah, we probably should :(
>
> OK... Here we go. I've converted all drivers in our CVS repository to a
> new model where we do the two kmallocs separately. I didn't commit it
> yet because it's a very important change (47 chip drivers affected). So
> I'd appreciate code reviews and tests before I apply it.
>
> The patch is here:
> http://jdelvare.net1.nerim.net/sensors/lm_sensors-CVS-separate-mallocs.diff
> It applies on latest CVS.
>
> I tested only the eeprom and lm90 drivers so far. Seems to work, but the
> changes are error-prone so what it "seems" is hardly enough to be sure
> it's correct.
At a quick glance it looks sane.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 11+ messages in thread
* Fix in eeprom.c
2005-05-19 6:24 Fix in eeprom.c Jean Delvare
` (4 preceding siblings ...)
2005-05-19 6:24 ` AW: " Ralf Rosch
@ 2005-05-19 6:24 ` Jean Delvare
2005-05-19 6:24 ` Greg KH
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Jean Delvare @ 2005-05-19 6:24 UTC (permalink / raw)
To: lm-sensors
> > OK... Here we go. I've converted all drivers in our CVS repository
> > to a new model where we do the two kmallocs separately. I didn't
> > commit it yet because it's a very important change (47 chip drivers
> > affected). So I'd appreciate code reviews and tests before I apply
> > it.
> >
> > The patch is here:
> > http://jdelvare.net1.nerim.net/sensors/lm_sensors-CVS-separate-mallocs.diff
> > It applies on latest CVS.
> >
> > I tested only the eeprom and lm90 drivers so far. Seems to work, but
> > the changes are error-prone so what it "seems" is hardly enough to
> > be sure it's correct.
>
> At a quick glance it looks sane.
Well, I doubt that a quick glance is enough to ensure that the patch
didn't break anything. I'm confident that the memory allocation and
"normal" freeing are correct. What I consider error-prone is the error
handling in detect functions. In several cases I had to rename labels.
It's hard to be sure that all error paths are absolutely correct,
although I did my best not to screw anything up.
--
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
^ permalink raw reply [flat|nested] 11+ messages in thread
* Fix in eeprom.c
2005-05-19 6:24 Fix in eeprom.c Jean Delvare
` (7 preceding siblings ...)
2005-05-19 6:24 ` Jean Delvare
@ 2005-05-19 6:24 ` Jean Delvare
2005-05-19 6:24 ` AW: " Ralf Rosch
9 siblings, 0 replies; 11+ messages in thread
From: Jean Delvare @ 2005-05-19 6:24 UTC (permalink / raw)
To: lm-sensors
Hi Ralf,
> I have applied your eeprom.c patch and tested.
> Your fix is quite similar to mine and works fine for me.
A different fix was prefered, causing less changes in the drivers (so
less error-prone). I just commited the change to our CVS repository. I
would appreciate it if you could check it out and test.
Thanks.
--
Jean Delvare
http://www.ensicaen.ismra.fr/~delvare/
^ permalink raw reply [flat|nested] 11+ messages in thread
* AW: Fix in eeprom.c
2005-05-19 6:24 Fix in eeprom.c Jean Delvare
` (8 preceding siblings ...)
2005-05-19 6:24 ` Jean Delvare
@ 2005-05-19 6:24 ` Ralf Rosch
9 siblings, 0 replies; 11+ messages in thread
From: Ralf Rosch @ 2005-05-19 6:24 UTC (permalink / raw)
To: lm-sensors
Hi Jean,
sorry for the long delay. I have tested the new source.
It seems to be o.k. so far for our system.
Thanks and regards
Ralf
> -----Ursprungliche Nachricht-----
> Von: ralf@arbeitsgruppe [mailto:ralf@arbeitsgruppe]Im Auftrag von Jean
> Delvare
> Gesendet: Samstag, 17. April 2004 19:22
> An: Ralf Roesch
> Cc: sensors@Stimpy.netroedge.com
> Betreff: Re: Fix in eeprom.c
>
>
> Hi Ralf,
>
> > I have applied your eeprom.c patch and tested.
> > Your fix is quite similar to mine and works fine for me.
>
> A different fix was prefered, causing less changes in the drivers (so
> less error-prone). I just commited the change to our CVS repository. I
> would appreciate it if you could check it out and test.
>
> Thanks.
>
> --
> Jean Delvare
> http://www.ensicaen.ismra.fr/~delvare/
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2005-05-19 6:24 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-19 6:24 Fix in eeprom.c Jean Delvare
2005-05-19 6:24 ` Jean Delvare
2005-05-19 6:24 ` AW: " Ralf Rosch
2005-05-19 6:24 ` Mark Studebaker
2005-05-19 6:24 ` Greg KH
2005-05-19 6:24 ` AW: " Ralf Rosch
2005-05-19 6:24 ` Jean Delvare
2005-05-19 6:24 ` Greg KH
2005-05-19 6:24 ` Jean Delvare
2005-05-19 6:24 ` Jean Delvare
2005-05-19 6:24 ` AW: " Ralf Rosch
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.