From: "Bruno Prémont" <bonbons@linux-vserver.org>
To: Jaya Kumar <jayakumar.lkml@gmail.com>
Cc: Jiri Kosina <jkosina@suse.cz>,
linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] HID: picolcd: fix deferred_io init/cleanup to
Date: Wed, 30 Jun 2010 05:56:57 +0000 [thread overview]
Message-ID: <20100630075657.47a325a6@pluto.restena.lu> (raw)
In-Reply-To: <AANLkTingjmM4OmkdXl9IOUe5zsj0QxTdix1h34pVHWGl@mail.gmail.com>
Hi Jaya,
On Wed, 30 Jun 2010 09:52:13 Jaya Kumar wrote:
> On Tue, Jun 29, 2010 at 4:29 AM, Bruno Prémont
> <bonbons@linux-vserver.org> wrote:
> > We need to call fb_deferred_io_init() before we
> > register_framebuffer() as otherwise, in case fbcon uses our
> > framebuffer, we will get a BUG() because in picolcd_fb_imageblit()
> > we schedule defio which has not been initialized yet.
>
> Hi Bruno,
>
> The comment above seems confusing to me in that it talks about fbcon
> and defio schedule.
Well I talk about fbcon as that's the trigger I have seen causing an
issue.
I'm fine with rewriting the changelog as to just talk about the
correct/expected order of initialization.
Thanks for looking at it,
Bruno
> What I see is that you originally had in picolcd:
>
> > error = register_framebuffer(info);
> ...
> > fb_deferred_io_init(info);
>
> which was a bug because it called register_framebuffer (ie: made the
> framebuffer available for use) and only then initialized the defio
> handlers which were needed for that framebuffer memory to be used.
> Drivers must always call defio_init _before_ register_framebuffer. The
> bug fix to picolcd below looks correct because it now does that
> sequence in the correct order.
>
> Thanks,
> jaya
>
>
>
> >
> > Note: this BUG() deadlocks ttys.
> >
> > Signed-off-by: Bruno Prémont <bonbons@linux-vserver.org>
> > ---
> > drivers/hid/hid-picolcd.c | 4 ++--
> > 1 files changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/hid/hid-picolcd.c b/drivers/hid/hid-picolcd.c
> > index 95253b3..883d720 100644
> > --- a/drivers/hid/hid-picolcd.c
> > +++ b/drivers/hid/hid-picolcd.c
> > @@ -707,18 +707,19 @@ static int picolcd_init_framebuffer(struct
> > picolcd_data *data) dev_err(dev, "failed to create sysfs
> > attributes\n"); goto err_cleanup;
> > }
> > + fb_deferred_io_init(info);
> > data->fb_info = info;
> > error = register_framebuffer(info);
> > if (error) {
> > dev_err(dev, "failed to register framebuffer\n");
> > goto err_sysfs;
> > }
> > - fb_deferred_io_init(info);
> > /* schedule first output of framebuffer */
> > schedule_delayed_work(&info->deferred_work, 0);
> > return 0;
> >
> > err_sysfs:
> > + fb_deferred_io_cleanup(info);
> > device_remove_file(dev, &dev_attr_fb_update_rate);
> > err_cleanup:
> > data->fb_vbitmap = NULL;
> > @@ -747,7 +748,6 @@ static void picolcd_exit_framebuffer(struct
> > picolcd_data *data) data->fb_bpp = 0;
> > data->fb_info = NULL;
> > device_remove_file(&data->hdev->dev,
> > &dev_attr_fb_update_rate);
> > - fb_deferred_io_cleanup(info);
> > unregister_framebuffer(info);
> > vfree(fb_bitmap);
> > kfree(fb_vbitmap);
> > --
> > 1.7.1
> >
> >
next prev parent reply other threads:[~2010-06-30 5:56 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-09 16:49 Deadlock between fbcon and fb_defio? Bruno Prémont
2010-05-10 0:00 ` Jaya Kumar
2010-05-10 6:00 ` Bruno Prémont
2010-05-26 19:58 ` vfree() and mmap()ed framebuffer with defio (Was: Deadlock Bruno Prémont
2010-05-30 11:09 ` [Patch] HID: Fix PicoLCD to allow it to run fbcon and handle unplug Bruno Prémont
2010-06-23 10:32 ` [Patch] HID: Fix PicoLCD to allow it to run fbcon and handle Bruno Prémont
2010-06-24 8:54 ` Jiri Kosina
2010-06-28 20:26 ` [Patch 0/4] " Bruno Prémont
2010-06-28 20:29 ` [PATCH 1/4] HID: picolcd: fix deferred_io init/cleanup to Bruno Prémont
2010-06-30 1:52 ` Jaya Kumar
2010-06-30 5:56 ` Bruno Prémont [this message]
2010-06-30 20:36 ` [PATCH 1/4 - adjusted changelog] HID: picolcd: fix deferred_io Bruno Prémont
2010-07-11 20:58 ` Jiri Kosina
2010-07-12 6:17 ` Bruno Prémont
2010-07-12 16:05 ` Jiri Kosina
2010-07-12 16:09 ` Jiri Kosina
2010-06-28 20:30 ` [PATCH 2/4] HID: picolcd: Add minimal palette required by fbcon on Bruno Prémont
2010-06-28 20:31 ` [PATCH 3/4] HID: picolcd: do not reallocate memory on depth change Bruno Prémont
2010-06-28 20:33 ` [PATCH 4/4] HID: picolcd: implement refcounting of framebuffer Bruno Prémont
2010-06-28 21:26 ` Bernie Thompson
2010-06-29 20:42 ` Bruno Prémont
2010-06-30 15:41 ` Bernie Thompson
2010-06-30 9:28 ` [Patch 0/4] HID: Fix PicoLCD to allow it to run fbcon and handle Jiri Kosina
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=20100630075657.47a325a6@pluto.restena.lu \
--to=bonbons@linux-vserver.org \
--cc=jayakumar.lkml@gmail.com \
--cc=jkosina@suse.cz \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).