2002-04-10 10:03:24

by Emmanuel Michon

[permalink] [raw]
Subject: module programming smp-safety howto?

Hi,

I'm responsible for the development of a kernel module for Sigma
Designs EM84xx PCI chips (MPEG2 and MPEG4 hardware decoder
boards). It's working properly now, irq sharing and multiple board
support is ok.

I would like to make it smp-safe.

For instance, I use at a place cli()/restore to implement something that
looks like a critical section (first code path is in a ioctl, second
in a irq top half). I guess this approach is wrong with smp.

Is there some documentation or howto about what changes compared
to non-smp computers?

Maybe a specific kernel module can be considered as a good model?

Sincerely yours,

--
Emmanuel Michon
Chef de projet
REALmagic France SAS
Mobile: 0614372733 GPGkeyID: D2997E42


2002-04-10 10:50:11

by Erik Mouw

[permalink] [raw]
Subject: Re: module programming smp-safety howto?

On Wed, Apr 10, 2002 at 12:03:23PM +0200, Emmanuel Michon wrote:
> I'm responsible for the development of a kernel module for Sigma
> Designs EM84xx PCI chips (MPEG2 and MPEG4 hardware decoder
> boards). It's working properly now, irq sharing and multiple board
> support is ok.
>
> I would like to make it smp-safe.
>
> For instance, I use at a place cli()/restore to implement something that
> looks like a critical section (first code path is in a ioctl, second
> in a irq top half). I guess this approach is wrong with smp.
>
> Is there some documentation or howto about what changes compared
> to non-smp computers?

Run "make psdocs" in your kernel tree, and you'll find Rusty's
kernel-locking guide in Documentation/DocBook/ . If you don't have the
proper tools, you can also download it from
http://www.kernelnewbies.org/documents/ .

> Maybe a specific kernel module can be considered as a good model?

I found the 8139too driver a nice source for good programming practice
(thanks, Jeff!).


Erik

--
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Faculty
of Information Technology and Systems, Delft University of Technology,
PO BOX 5031, 2600 GA Delft, The Netherlands Phone: +31-15-2783635
Fax: +31-15-2781843 Email: [email protected]
WWW: http://www-ict.its.tudelft.nl/~erik/

2002-04-10 13:33:21

by Anton Altaparmakov

[permalink] [raw]
Subject: Re: module programming smp-safety howto?

Look at Linux Kernel Internals available at:

http://www.moses.uklinux.net/patches/lki.html

Also, are we going to see the driver published under GPL (I sure hope
so!) or is it going to be binary only as per usual Sigma Designs policy?

Anton

On 10 Apr 2002, Emmanuel Michon wrote:

> Hi,
>
> I'm responsible for the development of a kernel module for Sigma
> Designs EM84xx PCI chips (MPEG2 and MPEG4 hardware decoder
> boards). It's working properly now, irq sharing and multiple board
> support is ok.
>
> I would like to make it smp-safe.
>
> For instance, I use at a place cli()/restore to implement something that
> looks like a critical section (first code path is in a ioctl, second
> in a irq top half). I guess this approach is wrong with smp.
>
> Is there some documentation or howto about what changes compared
> to non-smp computers?
>
> Maybe a specific kernel module can be considered as a good model?
>
> Sincerely yours,
>
> --
> Emmanuel Michon
> Chef de projet
> REALmagic France SAS
> Mobile: 0614372733 GPGkeyID: D2997E42
> -
> 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/
>

Best regards,

Anton
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Linux NTFS maintainer / WWW: http://linux-ntfs.sf.net/
IRC: #ntfs on irc.openprojects.net / ICQ: 8561279
WWW: http://www-stu.christs.cam.ac.uk/~aia21/

2002-04-10 16:42:37

by Emmanuel Michon

[permalink] [raw]
Subject: Re: module programming smp-safety howto?

Anton Altaparmakov <[email protected]> writes:

> http://www.moses.uklinux.net/patches/lki.html

thanks!

> Also, are we going to see the driver published under GPL (I sure hope
> so!) or is it going to be binary only as per usual Sigma Designs policy?

The core library (supporting the PCI chip and all devices attached
thru its i2c) is binary only.

The connection between the usual linux module api and this library
comes as source code for but is not GPL (NVIDIA driver like).

Unfortunately I personnally do not decide of this: many engineers work
at Sigma, with various backgrounds.

[This mail is a bit off topic, sorry. Any following discussion will
be completely for sure]

Sincerely yours,

--
Emmanuel Michon
Chef de projet
REALmagic France SAS
Mobile: 0614372733 GPGkeyID: D2997E42

2002-04-14 13:11:35

by pjd

[permalink] [raw]
Subject: Re: module programming smp-safety howto?

Emmanuel Michon wrote:
>
> Anton Altaparmakov <[email protected]> writes:
>
> > Also, are we going to see the driver published under GPL (I sure hope
> > so!) or is it going to be binary only as per usual Sigma Designs policy?
>
> The core library (supporting the PCI chip and all devices attached
> thru its i2c) is binary only.

If it's anything like the code that Sigma has for its 8400/8401, I
would keep it private out of sheer embarrassment, myself.

It sounds like you're doing from-the-ground-up new development, instead
of trying to port the user-space library for the 8400, which is a
good thing, as the 8400 code we licensed under NDA at my last position
was a steaming pile of dung. It also sounds like you're making a real
driver, instead of a shim driver that mmaps all the hardware for a
user-space library - another good design decision.

Peter Desnoyers