public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Brice Goglin <Brice.Goglin@ens-lyon.org>
To: Dave Airlie <airlied@gmail.com>
Cc: Mike Werner <werner@sgi.com>, Andrew Morton <akpm@osdl.org>,
	linux-kernel@vger.kernel.org, Linus Torvalds <torvalds@osdl.org>
Subject: Fix agp_backend usage in drm_agp_init (was: 2.6.11-mm3 - DRM/i915 broken)
Date: Sat, 19 Mar 2005 03:45:53 +0100	[thread overview]
Message-ID: <423B9261.9040108@ens-lyon.org> (raw)
In-Reply-To: <21d7e99705031601363f27296@mail.gmail.com>

Dave Airlie wrote:
>>DRM/i915 does not work on my Dell Dimension 3000 (i865 chipset).
> 
> This is more than likely caused by the multi-bridge AGP stuff in -bk3

Yes, that's it! The bug appeared in -mm when the multi-bridge AGP stuff
was merged (2.6.10-mm3). It is still here in 2.6.12-rc1.

Here's the scenario I think I'm seeing:

agpioc_acquire_wrap is called, it increments the agp_in_use. Then (before
agpioc_release_wrap happens), drm_agp_init is called (I don't know how).
drm_agp_init uses agp_backend_acquire which fails because agp_in_use is
non-null (hold by agpioc_acquire_wrap).

The multi-bridge AGP patch actually changed drm_agp_init by adding
agp_backend_acquire/release around agp_copy_info.
It is why drm_agp_init fails now while it worked before.

I don't think we need to "acquire" it during agp_copy_info.
Why don't we just get a pointer to the bridge instead ?
(is there any chance this bridge gets deleted during drm_agp_init ?)
That's what the attached patch implements on top of 2.6.12-rc1.

I chose to add a new agp_backend_find() function, but we might also
directly call agp_find_bridge() from drm_agp_init(). I don't know what's
the best.

I'm not familiar enough with DRM/AGP code to understand everything here.
I might be missing something...

Regards,
Brice


Signed-off-by: Brice Goglin <Brice.Goglin@ens-lyon.org>


--- linux-rc/include/linux/agp_backend.h.old	2005-03-19 03:26:36.000000000 +0100
+++ linux-rc/include/linux/agp_backend.h	2005-03-19 03:35:43.000000000 +0100
@@ -102,6 +102,7 @@ extern int agp_copy_info(struct agp_brid
  extern int agp_bind_memory(struct agp_memory *, off_t);
  extern int agp_unbind_memory(struct agp_memory *);
  extern void agp_enable(struct agp_bridge_data *, u32);
+extern struct agp_bridge_data *agp_backend_find(struct pci_dev *);
  extern struct agp_bridge_data *agp_backend_acquire(struct pci_dev *);
  extern void agp_backend_release(struct agp_bridge_data *);

--- linux-rc/drivers/char/agp/backend.c.old	2005-03-19 03:30:32.000000000 +0100
+++ linux-rc/drivers/char/agp/backend.c	2005-03-19 03:35:24.000000000 +0100
@@ -58,6 +58,12 @@ LIST_HEAD(agp_bridges);
  EXPORT_SYMBOL(agp_bridge);
  EXPORT_SYMBOL(agp_bridges);

+struct agp_bridge_data *agp_backend_find(struct pci_dev *pdev)
+{
+	return agp_find_bridge(pdev);
+}
+EXPORT_SYMBOL(agp_backend_find);
+
  /**
   *	agp_backend_acquire  -  attempt to acquire an agp backend.
   *
@@ -66,7 +72,7 @@ struct agp_bridge_data *agp_backend_acqu
  {
  	struct agp_bridge_data *bridge;

-	bridge = agp_find_bridge(pdev);
+	bridge = agp_backend_find(pdev);

  	if (!bridge)
  		return NULL;
--- linux-rc/drivers/char/drm/drm_agpsupport.c.old	2005-03-19 03:29:50.000000000 +0100
+++ linux-rc/drivers/char/drm/drm_agpsupport.c	2005-03-19 03:34:28.000000000 +0100
@@ -387,12 +387,11 @@ drm_agp_head_t *drm_agp_init(drm_device_
  	if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS)))
  		return NULL;
  	memset((void *)head, 0, sizeof(*head));
-	if (!(head->bridge = agp_backend_acquire(dev->pdev))) {
+	if (!(head->bridge = agp_backend_find(dev->pdev))) {
  		drm_free(head, sizeof(*head), DRM_MEM_AGPLISTS);
  		return NULL;
  	}
  	agp_copy_info(head->bridge, &head->agp_info);
-	agp_backend_release(head->bridge);
  	if (head->agp_info.chipset == NOT_SUPPORTED) {
  		drm_free(head, sizeof(*head), DRM_MEM_AGPLISTS);
  		return NULL;

  parent reply	other threads:[~2005-03-19  2:46 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-12 11:42 2.6.11-mm3 Andrew Morton
2005-03-12 12:20 ` 2.6.11-mm3 Jens Axboe
2005-03-12 12:41 ` 2.6.11-mm3 Reuben Farrelly
2005-03-12 15:51   ` 2.6.11-mm3 Anton Altaparmakov
2005-03-12 13:18 ` 2.6.11-mm3: saa7134-core.c compile error Adrian Bunk
2005-03-15  4:38   ` Andrew Morton
2005-03-15 17:47     ` Adrian Bunk
2005-03-12 13:40 ` 2.6.11-mm3 Ed Tomlinson
2005-03-12 15:52   ` 2.6.11-mm3 Anton Altaparmakov
2005-03-12 15:55 ` [2.6 patch] drivers/net/sis900.c: fix a warning Adrian Bunk
2005-03-12 17:30 ` [2.6 patch] drivers/video/intelfb/: " Adrian Bunk
2005-03-12 19:13 ` DRI breakage, 2.6.11-mm[123] Sean Neakums
2005-03-12 19:29   ` Sean Neakums
2005-03-12 23:13     ` Dave Airlie
2005-03-12 23:58       ` Dave Jones
2005-03-13 12:48         ` Sean Neakums
2005-03-13 13:34           ` Dave Airlie
2005-03-13 12:01 ` 2.6.11-mm3: machine check on sleep, PowerBook5.4 Sean Neakums
2005-03-13 12:23   ` Benjamin Herrenschmidt
2005-03-13 12:30   ` Benjamin Herrenschmidt
2005-03-13 12:35     ` Benjamin Herrenschmidt
2005-03-13 16:19       ` Sean Neakums
2005-03-13 19:07         ` Sean Neakums
2005-03-13 21:53           ` Benjamin Herrenschmidt
2005-03-13 22:08             ` Sean Neakums
2005-03-13 22:10               ` Benjamin Herrenschmidt
2005-03-13 22:12               ` Benjamin Herrenschmidt
2005-03-13 21:47         ` Benjamin Herrenschmidt
2005-03-13 16:31 ` 2.6.11-mm3 Barry K. Nathan
2005-03-14 16:25 ` 2.6.11-mm3 (compile stats) John Cherry
2005-03-14 21:54 ` 2.6.11-mm3 - DRM/i915 broken Brice Goglin
2005-03-14 22:30   ` Bernhard Rosenkraenzer
2005-03-14 22:57     ` Brice Goglin
2005-03-16  9:36       ` Dave Airlie
2005-03-17 18:57         ` Brice Goglin
2005-03-19  2:45         ` Brice Goglin [this message]
2005-03-19  3:40           ` Fix agp_backend usage in drm_agp_init (was: 2.6.11-mm3 - DRM/i915 broken) Jesse Barnes
2005-03-19  3:48             ` Jesse Barnes
2005-03-19 16:32               ` Jesse Barnes
     [not found]           ` <200503191247.48963.werner@sgi.com>
     [not found]             ` <21d7e9970503231247179b7c46@mail.gmail.com>
2005-03-24  8:45               ` Dave Airlie
2005-03-16 18:57       ` 2.6.11-mm3 - DRM/i915 broken Ruben Fonseca
2005-03-15  7:57 ` 2.6.11-mm3 Stefano Rivoir
2005-03-15 12:25 ` 2.6.11-mm3 mouse oddity Helge Hafting
2005-03-15 14:25   ` Dmitry Torokhov
2005-03-15 14:36     ` Vojtech Pavlik
2005-03-15 19:01     ` Andrew Morton
2005-03-15 19:33       ` Dave Jones
2005-03-15 19:34       ` Dmitry Torokhov
2005-03-15 19:54         ` Sean
2005-03-15 20:10       ` Vojtech Pavlik
2005-03-16  9:47         ` Helge Hafting
2005-03-16 17:29           ` Vojtech Pavlik
2005-03-16  9:44       ` Helge Hafting
2005-03-16 17:30         ` Vojtech Pavlik
2005-03-17 11:09           ` Helge Hafting
2005-03-17 12:14             ` Vojtech Pavlik
2005-03-15 15:06 ` 2.6.11-mm3: megaraid_sas.c: stack usage Adrian Bunk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=423B9261.9040108@ens-lyon.org \
    --to=brice.goglin@ens-lyon.org \
    --cc=airlied@gmail.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    --cc=werner@sgi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox