linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dexuan Cui <decui@microsoft.com>
To: Boqun Feng <boqun.feng@gmail.com>,
	"wei.liu@kernel.org" <wei.liu@kernel.org>
Cc: KY Srinivasan <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Stephen Hemminger <sthemmin@microsoft.com>,
	"b.zolnierkie@samsung.com" <b.zolnierkie@samsung.com>,
	"linux-hyperv@vger.kernel.org" <linux-hyperv@vger.kernel.org>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>,
	"linux-fbdev@vger.kernel.org" <linux-fbdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Michael Kelley <mikelley@microsoft.com>,
	Wei Hu <weh@microsoft.com>
Subject: RE: [PATCH] video: hyperv_fb: Directly use the MMIO VRAM
Date: Tue, 24 Nov 2020 08:33:32 +0000	[thread overview]
Message-ID: <MW2PR2101MB1801841901E659E60502EB86BFFB0@MW2PR2101MB1801.namprd21.prod.outlook.com> (raw)
In-Reply-To: <20201121145411.GG3025@boqun-archlinux>

Hi Wei Liu,
Please do not pick up this patch, because actually MMIO VRAM can not work
with fb_deferred_io.

Previously I didn't test Xorg -- sorry. As soon as I tested it, I got the below
warning and the Xorg program ternimated immediately:

[   28.148432] WARNING: CPU: 19 PID: 1410 at mm/vmalloc.c:383 vmalloc_to_page+0x14b/0x150
...
[   28.192959] CPU: 19 PID: 1410 Comm: Xorg Tainted: G            E     5.10.0-rc1+ #4
...
[   28.208720] RIP: 0010:vmalloc_to_page+0x14b/0x150
...
[   28.299231] Call Trace:
[   28.301428]  fb_deferred_io_fault+0x3a/0xa0
[   28.305276]  __do_fault+0x36/0x120
[   28.308276]  handle_mm_fault+0x1144/0x1950
[   28.311963]  exc_page_fault+0x290/0x510
[   28.315551]  ? asm_exc_page_fault+0x8/0x30
[   28.319186]  asm_exc_page_fault+0x1e/0x30
[   28.322969] RIP: 0033:0x7fbeda3ec2f5

The issue is that fb_deferred_io_page() requires that the PFN be backed by a
struct page, but it looks the MMIO address does not have the struct page backed.

So I have to drop this patch. 
Thanks Wei Hu and Michael for pointing this out!

FYI: drivers/video/fbdev/core/fb_defio.c:
static struct page *fb_deferred_io_page(struct fb_info *info, unsigned long offs)
{
        void *screen_base = (void __force *) info->screen_base;
        struct page *page;

        if (is_vmalloc_addr(screen_base + offs))
                page = vmalloc_to_page(screen_base + offs);
        else
                page = pfn_to_page((info->fix.smem_start + offs) >> PAGE_SHIFT);

        return page;
}

/* this is to find and return the vmalloc-ed fb pages */
static vm_fault_t fb_deferred_io_fault(struct vm_fault *vmf)
{
        unsigned long offset;
        struct page *page;
        struct fb_info *info = vmf->vma->vm_private_data;

        offset = vmf->pgoff << PAGE_SHIFT;
        if (offset >= info->fix.smem_len)
                return VM_FAULT_SIGBUS;

        page = fb_deferred_io_page(info, offset);
        if (!page)
                return VM_FAULT_SIGBUS;

Thanks,
-- Dexuan

  reply	other threads:[~2020-11-24  8:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-21  1:45 [PATCH] video: hyperv_fb: Directly use the MMIO VRAM Dexuan Cui
2020-11-21 14:54 ` Boqun Feng
2020-11-24  8:33   ` Dexuan Cui [this message]
2020-11-24 10:28     ` Wei Liu

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=MW2PR2101MB1801841901E659E60502EB86BFFB0@MW2PR2101MB1801.namprd21.prod.outlook.com \
    --to=decui@microsoft.com \
    --cc=b.zolnierkie@samsung.com \
    --cc=boqun.feng@gmail.com \
    --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=mikelley@microsoft.com \
    --cc=sthemmin@microsoft.com \
    --cc=weh@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;
as well as URLs for NNTP newsgroup(s).