mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michael Kelley <mhklinux@outlook.com>
To: Saurabh Singh Sengar <ssengar@linux.microsoft.com>
Cc: "kys@microsoft.com" <kys@microsoft.com>,
	"haiyangz@microsoft.com" <haiyangz@microsoft.com>,
	"wei.liu@kernel.org" <wei.liu@kernel.org>,
	"decui@microsoft.com" <decui@microsoft.com>,
	"deller@gmx.de" <deller@gmx.de>,
	"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	"linux-fbdev@vger.kernel.org" <linux-fbdev@vger.kernel.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"ssengar@microsoft.com" <ssengar@microsoft.com>
Subject: RE: [PATCH] fbdev: hyperv_fb: Allow graceful removal of framebuffer
Date: Mon, 24 Feb 2025 00:38:22 +0000	[thread overview]
Message-ID: <SN6PR02MB41571ED5CEA6B91A7F35AC3FD4C02@SN6PR02MB4157.namprd02.prod.outlook.com> (raw)
In-Reply-To: <20250223140933.GA16428@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net>

From: Saurabh Singh Sengar <ssengar@linux.microsoft.com> Sent: Sunday, February 23, 2025 6:10 AM
> 
> On Sat, Feb 22, 2025 at 08:16:53PM +0000, Michael Kelley wrote:
> > From: Saurabh Singh Sengar <ssengar@linux.microsoft.com> Sent: Saturday, February 22, 2025 9:27 AM
> > >

[anip]

> > >
> > > I had considered moving the entire `hvfb_putmem()` function to `destroy`,
> > > but I was hesitant for two reasons:
> > >
> > >   1. I wasn’t aware of any scenario where this would be useful. However,
> > >      your explanation has convinced me that it is necessary.
> > >   2. `hvfb_release_phymem()` relies on the `hdev` pointer, which requires
> > >      multiple `container_of` operations to derive it from the `info` pointer.
> > >      I was unsure if the complexity was justified, but it seems worthwhile now.
> > >
> > > I will move `hvfb_putmem()` to the `destroy` function in V2, and I hope this
> > > will address all the cases you mentioned.
> > >
> >
> > Yes, that's what I expect needs to happen, though I haven't looked at the
> > details of making sure all the needed data structures are still around. Like
> > you, I just had this sense that hvfb_putmem() might need to be moved as
> > well, so I tried to produce a failure scenario to prove it, which turned out
> > to be easy.
> >
> > Michael
> 
> I will add this in V2 as well. But I have found an another issue which is
> not very frequent.
> 
> 
> [  176.562153] ------------[ cut here ]------------
> [  176.562159] fb0: fb_WARN_ON_ONCE(pageref->page != page)
> [  176.562176] WARNING: CPU: 50 PID: 1522 at drivers/video/fbdev/core/fb_defio.c:67
> fb_deferred_io_mkwrite+0x215/0x280
> 
> <snip>
> 
> [  176.562258] Call Trace:
> [  176.562260]  <TASK>
> [  176.562263]  ? show_regs+0x6c/0x80
> [  176.562269]  ? __warn+0x8d/0x150
> [  176.562273]  ? fb_deferred_io_mkwrite+0x215/0x280
> [  176.562275]  ? report_bug+0x182/0x1b0
> [  176.562280]  ? handle_bug+0x133/0x1a0
> [  176.562283]  ? exc_invalid_op+0x18/0x80
> [  176.562284]  ? asm_exc_invalid_op+0x1b/0x20
> [  176.562289]  ? fb_deferred_io_mkwrite+0x215/0x280
> [  176.562291]  ? fb_deferred_io_mkwrite+0x215/0x280
> [  176.562293]  do_page_mkwrite+0x4d/0xb0
> [  176.562296]  do_wp_page+0xe8/0xd50
> [  176.562300]  ? ___pte_offset_map+0x1c/0x1b0
> [  176.562304]  __handle_mm_fault+0xbe1/0x10e0
> [  176.562307]  handle_mm_fault+0x17f/0x2e0
> [  176.562309]  do_user_addr_fault+0x2d1/0x8d0
> [  176.562314]  exc_page_fault+0x85/0x1e0
> [  176.562318]  asm_exc_page_fault+0x27/0x30
> 
> Looks this is because driver is unbind still Xorg is trying to write
> to memory which is causing some page faults. I have confirmed PID 1522
> is of Xorg. I think this is because we need to cancel the framebuffer
> deferred work after flushing it.

Does this new issue occur even after moving hvfb_putmem()
into the destroy() function?  I'm hoping it doesn't. I've
looked at the fb_deferred_io code, and can't quite figure out
how that deferred I/O work is supposed to get cancelled. Or
maybe it's just not supposed to get started again after the flush.

If the new issue still happens, that seems like more of a flaw
in the fb deferred I/O mechanism not shutting itself down
properly.

Michael

> 
> After adding the below in hvfb_remove I don't see this issue anymore.
> Although as the issue is not very frequent I am not 100% sure.
> 
> 	cancel_delayed_work_sync(&info->deferred_work);
> 
> If you think this is reasonable I can add this as well in V2.
> 

  reply	other threads:[~2025-02-24  0:38 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-15  9:20 Saurabh Sengar
2025-02-19  5:22 ` Michael Kelley
2025-02-22 17:27   ` Saurabh Singh Sengar
2025-02-22 20:16     ` Michael Kelley
2025-02-23 14:09       ` Saurabh Singh Sengar
2025-02-24  0:38         ` Michael Kelley [this message]
2025-02-24 13:29           ` Saurabh Singh Sengar
2025-02-24 19:24             ` Michael Kelley

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=SN6PR02MB41571ED5CEA6B91A7F35AC3FD4C02@SN6PR02MB4157.namprd02.prod.outlook.com \
    --to=mhklinux@outlook.com \
    --cc=akpm@linux-foundation.org \
    --cc=decui@microsoft.com \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ssengar@linux.microsoft.com \
    --cc=ssengar@microsoft.com \
    --cc=wei.liu@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

all inboxes | Powered by JetHome®