All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Bruno Prémont" <bonbons@linux-vserver.org>
To: Tejun Heo <tj@kernel.org>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jiri Kosina <jkosina@suse.cz>,
	linux-fbdev@vger.kernel.org
Subject: Re: [PATCH 0/7] HID: picoLCD updates
Date: Tue, 14 Aug 2012 06:30:44 +0000	[thread overview]
Message-ID: <20120814083044.78b401d2@pluto.restena.lu> (raw)
In-Reply-To: <20120813232708.GF25632@google.com>

Hello Tejun,

[Tejun: sorry for duplicate, did hit "reply" instead of "reply to all"]

On Mon, 13 Aug 2012 16:27:08 Tejun Heo <tj@kernel.org> wrote:
> On Thu, Aug 09, 2012 at 08:09:47PM +0200, Bruno Prémont wrote:
> > As you are working on workqueues and related code, could you have a look
> > at my usage of them in combination with db_defio?
> > 
> > The delayed memory corruptions or system reboots after unbinding/unplugging
> > the PicoLCD seem very much related to workqueue used to handle the deferred
> > IO to framebuffer.
> > 
> > I think things don't get cleaned-up as they should though I'm not sure
> > where the trouble lies.
> > 
> > For ease of reading, I'm inlineing below the framebuffer related code of
> > PicoLCD (for complete driver after this patch series apply the whole series
> > on top of 3.5 https://lkml.org/lkml/2012/7/30/375 )
> ...
> > void picolcd_exit_framebuffer(struct picolcd_data *data)
> > {
> > 	struct fb_info *info = data->fb_info;
> > 	u8 *fb_vbitmap = data->fb_vbitmap;
> > 
> > 	if (!info)
> > 		return;
> > 
> > 	device_remove_file(&data->hdev->dev, &dev_attr_fb_update_rate);
> > 	info->par = NULL;
> > 	unregister_framebuffer(info);
> > 	data->fb_vbitmap = NULL;
> > 	data->fb_bitmap  = NULL;
> > 	data->fb_bpp     = 0;
> > 	data->fb_info    = NULL;
> > 	kfree(fb_vbitmap);
> > }
> 
> I'm kinda shooting in the dark but who flushes / cancels
> fb_info->deferred_work?

fb_deferred_io_cleanup() does so and is called by destroy fbops
(when last reference to fb_info is returned):


static void picolcd_fb_destroy(struct fb_info *info)
{
	/* make sure no work is deferred */
	fb_deferred_io_cleanup(info);

	vfree((u8 *)info->fix.smem_start);
	framebuffer_release(info);
	printk(KERN_DEBUG "picolcd_fb_destroy(%p)\n", info);
}


=== drivers/video/fb_defio.c ==void fb_deferred_io_cleanup(struct fb_info *info)
{
        struct fb_deferred_io *fbdefio = info->fbdefio;
        struct page *page;
        int i;

        BUG_ON(!fbdefio);
        cancel_delayed_work_sync(&info->deferred_work);

        /* clear out the mapping that we setup */
        for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) {
                page = fb_deferred_io_page(info, i);
                page->mapping = NULL;
        }

        info->fbops->fb_mmap = NULL;
        mutex_destroy(&fbdefio->lock);
}



Thanks,
Bruno

WARNING: multiple messages have this Message-ID (diff)
From: "Bruno Prémont" <bonbons@linux-vserver.org>
To: Tejun Heo <tj@kernel.org>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jiri Kosina <jkosina@suse.cz>,
	linux-fbdev@vger.kernel.org
Subject: Re: [PATCH 0/7] HID: picoLCD updates
Date: Tue, 14 Aug 2012 08:30:44 +0200	[thread overview]
Message-ID: <20120814083044.78b401d2@pluto.restena.lu> (raw)
In-Reply-To: <20120813232708.GF25632@google.com>

Hello Tejun,

[Tejun: sorry for duplicate, did hit "reply" instead of "reply to all"]

On Mon, 13 Aug 2012 16:27:08 Tejun Heo <tj@kernel.org> wrote:
> On Thu, Aug 09, 2012 at 08:09:47PM +0200, Bruno Prémont wrote:
> > As you are working on workqueues and related code, could you have a look
> > at my usage of them in combination with db_defio?
> > 
> > The delayed memory corruptions or system reboots after unbinding/unplugging
> > the PicoLCD seem very much related to workqueue used to handle the deferred
> > IO to framebuffer.
> > 
> > I think things don't get cleaned-up as they should though I'm not sure
> > where the trouble lies.
> > 
> > For ease of reading, I'm inlineing below the framebuffer related code of
> > PicoLCD (for complete driver after this patch series apply the whole series
> > on top of 3.5 https://lkml.org/lkml/2012/7/30/375 )
> ...
> > void picolcd_exit_framebuffer(struct picolcd_data *data)
> > {
> > 	struct fb_info *info = data->fb_info;
> > 	u8 *fb_vbitmap = data->fb_vbitmap;
> > 
> > 	if (!info)
> > 		return;
> > 
> > 	device_remove_file(&data->hdev->dev, &dev_attr_fb_update_rate);
> > 	info->par = NULL;
> > 	unregister_framebuffer(info);
> > 	data->fb_vbitmap = NULL;
> > 	data->fb_bitmap  = NULL;
> > 	data->fb_bpp     = 0;
> > 	data->fb_info    = NULL;
> > 	kfree(fb_vbitmap);
> > }
> 
> I'm kinda shooting in the dark but who flushes / cancels
> fb_info->deferred_work?

fb_deferred_io_cleanup() does so and is called by destroy fbops
(when last reference to fb_info is returned):


static void picolcd_fb_destroy(struct fb_info *info)
{
	/* make sure no work is deferred */
	fb_deferred_io_cleanup(info);

	vfree((u8 *)info->fix.smem_start);
	framebuffer_release(info);
	printk(KERN_DEBUG "picolcd_fb_destroy(%p)\n", info);
}


===== drivers/video/fb_defio.c =====
void fb_deferred_io_cleanup(struct fb_info *info)
{
        struct fb_deferred_io *fbdefio = info->fbdefio;
        struct page *page;
        int i;

        BUG_ON(!fbdefio);
        cancel_delayed_work_sync(&info->deferred_work);

        /* clear out the mapping that we setup */
        for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) {
                page = fb_deferred_io_page(info, i);
                page->mapping = NULL;
        }

        info->fbops->fb_mmap = NULL;
        mutex_destroy(&fbdefio->lock);
}



Thanks,
Bruno
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

WARNING: multiple messages have this Message-ID (diff)
From: "Bruno Prémont" <bonbons@linux-vserver.org>
To: Tejun Heo <tj@kernel.org>
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Jiri Kosina <jkosina@suse.cz>,
	linux-fbdev@vger.kernel.org
Subject: Re: [PATCH 0/7] HID: picoLCD updates
Date: Tue, 14 Aug 2012 08:30:44 +0200	[thread overview]
Message-ID: <20120814083044.78b401d2@pluto.restena.lu> (raw)
In-Reply-To: <20120813232708.GF25632@google.com>

Hello Tejun,

[Tejun: sorry for duplicate, did hit "reply" instead of "reply to all"]

On Mon, 13 Aug 2012 16:27:08 Tejun Heo <tj@kernel.org> wrote:
> On Thu, Aug 09, 2012 at 08:09:47PM +0200, Bruno Prémont wrote:
> > As you are working on workqueues and related code, could you have a look
> > at my usage of them in combination with db_defio?
> > 
> > The delayed memory corruptions or system reboots after unbinding/unplugging
> > the PicoLCD seem very much related to workqueue used to handle the deferred
> > IO to framebuffer.
> > 
> > I think things don't get cleaned-up as they should though I'm not sure
> > where the trouble lies.
> > 
> > For ease of reading, I'm inlineing below the framebuffer related code of
> > PicoLCD (for complete driver after this patch series apply the whole series
> > on top of 3.5 https://lkml.org/lkml/2012/7/30/375 )
> ...
> > void picolcd_exit_framebuffer(struct picolcd_data *data)
> > {
> > 	struct fb_info *info = data->fb_info;
> > 	u8 *fb_vbitmap = data->fb_vbitmap;
> > 
> > 	if (!info)
> > 		return;
> > 
> > 	device_remove_file(&data->hdev->dev, &dev_attr_fb_update_rate);
> > 	info->par = NULL;
> > 	unregister_framebuffer(info);
> > 	data->fb_vbitmap = NULL;
> > 	data->fb_bitmap  = NULL;
> > 	data->fb_bpp     = 0;
> > 	data->fb_info    = NULL;
> > 	kfree(fb_vbitmap);
> > }
> 
> I'm kinda shooting in the dark but who flushes / cancels
> fb_info->deferred_work?

fb_deferred_io_cleanup() does so and is called by destroy fbops
(when last reference to fb_info is returned):


static void picolcd_fb_destroy(struct fb_info *info)
{
	/* make sure no work is deferred */
	fb_deferred_io_cleanup(info);

	vfree((u8 *)info->fix.smem_start);
	framebuffer_release(info);
	printk(KERN_DEBUG "picolcd_fb_destroy(%p)\n", info);
}


===== drivers/video/fb_defio.c =====
void fb_deferred_io_cleanup(struct fb_info *info)
{
        struct fb_deferred_io *fbdefio = info->fbdefio;
        struct page *page;
        int i;

        BUG_ON(!fbdefio);
        cancel_delayed_work_sync(&info->deferred_work);

        /* clear out the mapping that we setup */
        for (i = 0 ; i < info->fix.smem_len; i += PAGE_SIZE) {
                page = fb_deferred_io_page(info, i);
                page->mapping = NULL;
        }

        info->fbops->fb_mmap = NULL;
        mutex_destroy(&fbdefio->lock);
}



Thanks,
Bruno

  reply	other threads:[~2012-08-14  6:30 UTC|newest]

Thread overview: 102+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-30 19:36 [PATCH 0/7] HID: picoLCD updates Bruno Prémont
2012-07-30 19:36 ` Bruno Prémont
2012-07-30 19:38 ` [PATCH 1/7] HID: picoLCD: split driver code Bruno Prémont
2012-07-30 19:59   ` Bruno Prémont
2012-07-30 19:59     ` Bruno Prémont
2012-07-30 19:38 ` [PATCH 2/7] HID: picoLCD: Replace own refcounting with fbdev's Bruno Prémont
2012-07-30 19:38   ` Bruno Prémont
2012-07-30 19:38 ` [PATCH 3/7] HID: picoLCD: prevent NULL pointer dereference on unplug Bruno Prémont
2012-07-30 19:38   ` Bruno Prémont
2012-07-30 19:38 ` [PATCH 4/7] HID: picoLCD: satify some checkpatch warnings Bruno Prémont
2012-07-30 19:38   ` Bruno Prémont
2012-07-30 19:38 ` [PATCH 5/7] HID: picoLCD: Improve unplug handling Bruno Prémont
2012-07-30 19:38   ` Bruno Prémont
2012-07-30 19:38 ` [PATCH 6/7] HID: picoLCD: disable version check during probe Bruno Prémont
2012-07-30 19:38   ` Bruno Prémont
2012-08-15  8:15   ` Jiri Kosina
2012-08-15  8:15     ` Jiri Kosina
2012-08-19 16:56     ` [PATCH 6/7 v2] HID: picoLCD: drop " Bruno Prémont
2012-08-19 16:56       ` Bruno Prémont
2012-08-19 16:56       ` Bruno Prémont
2012-09-17 18:21       ` Bruno Prémont
2012-09-17 18:21         ` Bruno Prémont
2012-09-17 18:21         ` Bruno Prémont
2012-09-19 11:45         ` Jiri Kosina
2012-09-19 11:45           ` Jiri Kosina
2012-09-19 11:45           ` Jiri Kosina
2012-07-30 19:39 ` [PATCH 7/7] HID: picoLCD: add myself to MAINTAINERS Bruno Prémont
2012-07-30 19:39   ` Bruno Prémont
2012-07-31  7:26 ` [PATCH 0/7] HID: picoLCD updates David Herrmann
2012-07-31  7:26   ` David Herrmann
2012-07-31  7:26   ` David Herrmann
2012-07-31  7:59   ` Bruno Prémont
2012-07-31  7:59     ` Bruno Prémont
2012-08-09 18:09 ` Bruno Prémont
2012-08-09 18:09   ` Bruno Prémont
2012-08-13 23:27   ` Tejun Heo
2012-08-13 23:27     ` Tejun Heo
2012-08-13 23:27     ` Tejun Heo
2012-08-14  6:30     ` Bruno Prémont [this message]
2012-08-14  6:30       ` Bruno Prémont
2012-08-14  6:30       ` Bruno Prémont
2012-08-14 17:31       ` Tejun Heo
2012-08-14 17:31         ` Tejun Heo
2012-08-14 17:31         ` Tejun Heo
2012-08-15  8:27 ` Jiri Kosina
2012-08-15  8:27   ` Jiri Kosina
2012-08-15  8:27   ` Jiri Kosina
2012-08-15  9:42   ` Bruno Prémont
2012-08-15  9:42     ` Bruno Prémont
2012-08-15  9:42     ` Bruno Prémont
2012-08-15 12:11     ` Jiri Kosina
2012-08-15 12:11       ` Jiri Kosina
2012-08-15 12:11       ` Jiri Kosina
2012-08-15 15:16       ` Bruno Prémont
2012-08-15 15:16         ` Bruno Prémont
2012-08-15 21:32         ` Jiri Kosina
2012-08-15 21:32           ` Jiri Kosina
2012-08-15 21:32           ` Jiri Kosina
2012-08-16 16:30           ` Bruno Prémont
2012-08-16 16:30             ` Bruno Prémont
2012-08-16 16:30             ` Bruno Prémont
2012-08-16 16:47             ` Jiri Kosina
2012-08-16 16:47               ` Jiri Kosina
2012-08-18 12:40               ` Bruno Prémont
2012-08-18 12:40                 ` Bruno Prémont
2012-08-18 13:19                 ` Alan Stern
2012-08-18 13:19                   ` Alan Stern
2012-08-18 13:19                   ` Alan Stern
2012-08-18 13:48                   ` Bruno Prémont
2012-08-18 13:48                     ` Bruno Prémont
2012-08-18 13:48                     ` Bruno Prémont
2012-08-18 18:49                     ` Bruno Prémont
2012-08-18 18:49                       ` Bruno Prémont
2012-08-18 18:49                       ` Bruno Prémont
2012-08-19  0:11                     ` Alan Stern
2012-08-19  0:11                       ` Alan Stern
2012-08-19  0:11                       ` Alan Stern
2012-08-19 16:23                       ` Bruno Prémont
2012-08-19 16:23                         ` Bruno Prémont
2012-08-19 16:23                         ` Bruno Prémont
2012-08-19 19:56                         ` Alan Stern
2012-08-19 19:56                           ` Alan Stern
2012-08-19 19:56                           ` Alan Stern
2012-08-19 17:28 ` [PATCH 0/6] HID: picoLCD additional fixes + CIR support Bruno Prémont
2012-08-19 17:28   ` Bruno Prémont
2012-08-19 17:31   ` [PATCH 1/6] HID: picoLCD: prevent NULL pointer dereferences Bruno Prémont
2012-08-19 17:31     ` Bruno Prémont
2012-08-19 17:32   ` [PATCH 2/6] HID: picoLCD: rework hid-fbdev interaction Bruno Prémont
2012-08-19 17:32     ` Bruno Prémont
2012-08-19 17:32     ` Bruno Prémont
2012-08-19 17:32   ` [PATCH 3/6] HID: picoLCD: Add support for CIR Bruno Prémont
2012-08-19 17:32     ` Bruno Prémont
2012-09-14 14:15     ` Mauro Carvalho Chehab
2012-09-14 14:15       ` Mauro Carvalho Chehab
2012-08-19 17:33   ` [PATCH 4/6] HID: picoLCD: optimize for inactive debugfs Bruno Prémont
2012-08-19 17:33     ` Bruno Prémont
2012-08-19 17:33   ` [PATCH 5/6] HID: picoLCD: fix dumping of IR_DATA report Bruno Prémont
2012-08-19 17:33     ` Bruno Prémont
2012-08-19 17:33   ` [PATCH 6/6] HID: picoLCD: use proper device as input_dev parent Bruno Prémont
2012-08-19 17:33     ` Bruno Prémont
2012-09-05  9:50   ` [PATCH 0/6] HID: picoLCD additional fixes + CIR support Jiri Kosina
2012-09-05  9:50     ` 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=20120814083044.78b401d2@pluto.restena.lu \
    --to=bonbons@linux-vserver.org \
    --cc=jkosina@suse.cz \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@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 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.