Welcome to Soft32 Linux Forums!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

cmpxchg is not available to generic code

 
   Soft32 Home -> Linux -> Kernel RSS
Next:  PCI Quirk / Hidden Bus Report  
Author Message
Andrew Morton

External


Since: Feb 02, 2007
Posts: 2642



(Msg. 1) Posted: Thu Jul 19, 2007 4:10 am
Post subject: cmpxchg is not available to generic code
Archived from groups: linux>kernel (more info?)

arm:

drivers/char/drm/drm_lock.c: In function `drm_lock_take':
drivers/char/drm/drm_lock.c:221: error: implicit declaration of function `cmpxchg'

You might be able to use atomic_cmpxchg, which _is_ present
on all architectures. Or use a spinlock.

What's that code doing anyway? driver-private locking primitives?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
David Miller

External


Since: May 26, 2007
Posts: 1211



(Msg. 2) Posted: Thu Jul 19, 2007 5:30 am
Post subject: Re: cmpxchg is not available to generic code [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

From: Andrew Morton <akpm RemoveThis @linux-foundation.org>
Date: Thu, 19 Jul 2007 00:05:49 -0700

> What's that code doing anyway? driver-private locking primitives?

It's an atomic lock shared with userspace. Whatever implementation is
used to do the lock on that object must be identical in the userspace
DRM bits.

Unlike futex, the lock operation on the user side isn't optional.
So if the platform can't do a true cmpxchg it generally cannot
support DRM.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo RemoveThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Andrew Morton

External


Since: Feb 02, 2007
Posts: 2642



(Msg. 3) Posted: Thu Jul 19, 2007 5:30 am
Post subject: Re: cmpxchg is not available to generic code [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Thu, 19 Jul 2007 09:02:03 +0100 (IST) Dave Airlie <airlied.DeleteThis@linux.ie> wrote:

>
>
> > arm:
> >
> > drivers/char/drm/drm_lock.c: In function `drm_lock_take':
> > drivers/char/drm/drm_lock.c:221: error: implicit declaration of function `cmpxchg'
> >
> > You might be able to use atomic_cmpxchg, which _is_ present
> > on all architectures. Or use a spinlock.
> >
> > What's that code doing anyway? driver-private locking primitives?
>
> When did arm suddenly start wanting DRM?

It's selectable in config. allmodconfig broke.

> they need to grow a userpsace
> cmpxchg as davem mentioned to go along with this, changing the drm now
> isn't possible due to backwards compat..

For reference purposes, that position is not acceptable. We _never_ accept the
"oh I can't change my proposed kernel interface because I already have
userspace relying on it" argument.

Hopefully that won't be an issue here. I guess DRM now needs a
`depends on !ARM'.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Dave Airlie

External


Since: Jan 10, 2007
Posts: 66



(Msg. 4) Posted: Thu Jul 19, 2007 5:30 am
Post subject: Re: cmpxchg is not available to generic code [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 7/19/07, Andrew Morton <akpm DeleteThis @linux-foundation.org> wrote:
> On Thu, 19 Jul 2007 18:15:03 +1000 "Dave Airlie" <airlied DeleteThis @gmail.com> wrote:
>
> > Maybe we could add CONFIG_HAVE_CMPXCHG and let DRM depend on it..
>
> That would certainly be better than adding a sprinkle of architectures
> in DRM Kconfig dependencies.
>
> I don't know how important DRM is on ARM. Zero?
>

I'd guess zero I suppose if you wanted you could hook up a PCI
graphics card on ARM, but if you do that I think you could implement
cmpxchg Smile

Dave.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Andrew Morton

External


Since: Feb 02, 2007
Posts: 2642



(Msg. 5) Posted: Thu Jul 19, 2007 5:30 am
Post subject: Re: cmpxchg is not available to generic code [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Thu, 19 Jul 2007 18:15:03 +1000 "Dave Airlie" <airlied.DeleteThis@gmail.com> wrote:

> Maybe we could add CONFIG_HAVE_CMPXCHG and let DRM depend on it..

That would certainly be better than adding a sprinkle of architectures
in DRM Kconfig dependencies.

I don't know how important DRM is on ARM. Zero?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Andrew Morton

External


Since: Feb 02, 2007
Posts: 2642



(Msg. 6) Posted: Thu Jul 19, 2007 5:40 am
Post subject: Re: cmpxchg is not available to generic code [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Thu, 19 Jul 2007 09:19:10 +0100 (IST) Dave Airlie <airlied.DeleteThis@linux.ie> wrote:

> >
> >> they need to grow a userpsace
> >> cmpxchg as davem mentioned to go along with this, changing the drm now
> >> isn't possible due to backwards compat..
> >
> > For reference purposes, that position is not acceptable. We _never_ accept the
> > "oh I can't change my proposed kernel interface because I already have
> > userspace relying on it" argument.
>
> Yes it is, I thought breaking userspace API was the worst crime in kernel
> history, (unless you are sysfs...) the userspace DRM has been around since
> 2.2 days at least, so there are lots of legacy userspaces to break..

oh, sorry, I thought this cmpxchg stuff was newly-added.

I guess something changed which has now made DRM available under arm
allmodconfig.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Dave Airlie

External


Since: Jan 10, 2007
Posts: 66



(Msg. 7) Posted: Thu Jul 19, 2007 5:50 am
Post subject: Re: cmpxchg is not available to generic code [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 7/19/07, David Miller <davem DeleteThis @davemloft.net> wrote:
> From: Andrew Morton <akpm DeleteThis @linux-foundation.org>
> Date: Thu, 19 Jul 2007 00:05:49 -0700
>
> > What's that code doing anyway? driver-private locking primitives?
>
> It's an atomic lock shared with userspace. Whatever implementation is
> used to do the lock on that object must be identical in the userspace
> DRM bits.
>
> Unlike futex, the lock operation on the user side isn't optional.
> So if the platform can't do a true cmpxchg it generally cannot
> support DRM.

Actually in theory the userspace side is optional, it should fallback
to always entering the kernel and being slow, but Ive no idea how
well that codepath is tested... but it's an area I'd hate to play with
now ..

Maybe we could add CONFIG_HAVE_CMPXCHG and let DRM depend on it..

Dave.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Dave Airlie

External


Since: Dec 07, 2006
Posts: 34



(Msg. 8) Posted: Thu Jul 19, 2007 5:50 am
Post subject: Re: cmpxchg is not available to generic code [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

> arm:
>
> drivers/char/drm/drm_lock.c: In function `drm_lock_take':
> drivers/char/drm/drm_lock.c:221: error: implicit declaration of function `cmpxchg'
>
> You might be able to use atomic_cmpxchg, which _is_ present
> on all architectures. Or use a spinlock.
>
> What's that code doing anyway? driver-private locking primitives?

When did arm suddenly start wanting DRM? they need to grow a userpsace
cmpxchg as davem mentioned to go along with this, changing the drm now
isn't possible due to backwards compat..

Dave.

--
David Airlie, Software Engineer
http://www.skynet.ie/~airlied / airlied at skynet.ie
Linux kernel - DRI, VAX / pam_smb / ILUG

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Dave Airlie

External


Since: Dec 07, 2006
Posts: 34



(Msg. 9) Posted: Thu Jul 19, 2007 6:10 am
Post subject: Re: cmpxchg is not available to generic code [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

>
>> they need to grow a userpsace
>> cmpxchg as davem mentioned to go along with this, changing the drm now
>> isn't possible due to backwards compat..
>
> For reference purposes, that position is not acceptable. We _never_ accept the
> "oh I can't change my proposed kernel interface because I already have
> userspace relying on it" argument.

Yes it is, I thought breaking userspace API was the worst crime in kernel
history, (unless you are sysfs...) the userspace DRM has been around since
2.2 days at least, so there are lots of legacy userspaces to break..

> Hopefully that won't be an issue here. I guess DRM now needs a
> `depends on !ARM'.

Possibly the answer..

Dave.

--
David Airlie, Software Engineer
http://www.skynet.ie/~airlied / airlied at skynet.ie
Linux kernel - DRI, VAX / pam_smb / ILUG

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.RemoveThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
David Miller

External


Since: May 26, 2007
Posts: 1211



(Msg. 10) Posted: Thu Jul 19, 2007 6:00 pm
Post subject: Re: cmpxchg is not available to generic code [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

From: Andrew Morton <akpm DeleteThis @linux-foundation.org>
Date: Thu, 19 Jul 2007 01:21:41 -0700

> On Thu, 19 Jul 2007 18:15:03 +1000 "Dave Airlie" <airlied DeleteThis @gmail.com> wrote:
>
> > Maybe we could add CONFIG_HAVE_CMPXCHG and let DRM depend on it..
>
> That would certainly be better than adding a sprinkle of architectures
> in DRM Kconfig dependencies.
>
> I don't know how important DRM is on ARM. Zero?

We already have EMULATED_CMPXCHG guarding DRM.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo DeleteThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
David Miller

External


Since: May 26, 2007
Posts: 1211



(Msg. 11) Posted: Thu Jul 19, 2007 6:00 pm
Post subject: Re: cmpxchg is not available to generic code [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

From: "Dave Airlie" <airlied.DeleteThis@gmail.com>
Date: Thu, 19 Jul 2007 18:15:03 +1000

> Maybe we could add CONFIG_HAVE_CMPXCHG and let DRM depend on it..

There is already a "!EMULATED_CMPXCHG" guarding DRM, perhaps
ARM's Kconfig can set that if appropriate.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo.DeleteThis@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Nick Piggin

External


Since: Nov 27, 2006
Posts: 373



(Msg. 12) Posted: Mon Jul 23, 2007 3:50 am
Post subject: Re: cmpxchg is not available to generic code [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Dave Airlie wrote:
> On 7/19/07, Andrew Morton <akpm RemoveThis @linux-foundation.org> wrote:
>
>> On Thu, 19 Jul 2007 18:15:03 +1000 "Dave Airlie" <airlied RemoveThis @gmail.com>
>> wrote:
>>
>> > Maybe we could add CONFIG_HAVE_CMPXCHG and let DRM depend on it..
>>
>> That would certainly be better than adding a sprinkle of architectures
>> in DRM Kconfig dependencies.
>>
>> I don't know how important DRM is on ARM. Zero?
>>
>
> I'd guess zero I suppose if you wanted you could hook up a PCI
> graphics card on ARM, but if you do that I think you could implement
> cmpxchg Smile

ARM does the locked load / store conditional thing which is at least as
strong as cmpxchg, so I imagine it could implement this API in kernel
and userspace quite easily if needed.

--
SUSE Labs, Novell Inc.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo RemoveThis @vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to top
Login to vote
Display posts from previous:   
Related Topics:
[PATCH] WorkStruct: Implement generic UP cmpxchg() where a.. - From: David Howells <dhowells@redhat.com> Implement generic UP cmpxchg() where an arch doesn't otherwise support...

[PATCH] WorkStruct: Implement generic UP cmpxchg() where a.. - Implement generic UP cmpxchg() where an arch doesn't otherwise support it. This assuming that the arch doesn't have..

[PATCH 0/2] use symbolic constants in generic lseek code - The generic lseek code in fs/read_write.c uses hardcoded values for SEEK_{SET,CUR,END}. Patch 1 fixes the case..

[RFC PATCH 2/3] Generic Trace Setup and Control (GTSC) code - The Generic Tracing and Control Interface (GTSC) code. Signed-off-by: Tom Zanussi <zanussi@us.ibm.com> Signed-of...

[PATCH 2/7] ICH Force HPET: Restructure hpet generic clock.. - Restructure and rename legacy replacement mode HPET timer support. Just the code structural changes and should be zero....

[PATCH] Make asm-generic/ioctl.h more generic using condit.. - Allow individual architectures to override a small set of macros before including asm-generic/ioctl.h, in order to..
       Soft32 Home -> Linux -> Kernel All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Categories:
 Windows
  Linux
 Mac
 PDA


[ Contact us | Terms of Service/Privacy Policy ]