All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: "Alex Ng \(LIS\)" <alexng@microsoft.com>
Cc: "devel\@linuxdriverproject.org" <devel@linuxdriverproject.org>,
	"linux-kernel\@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Haiyang Zhang" <haiyangz@microsoft.com>,
	KY Srinivasan <kys@microsoft.com>
Subject: Re: [PATCH 2/4] Drivers: hv: balloon: account for gaps in hot add regions
Date: Mon, 08 Aug 2016 11:38:11 +0200	[thread overview]
Message-ID: <87wpjrob24.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <BN3PR03MB2146DADD381A3822CDB0F49AD8190@BN3PR03MB2146.namprd03.prod.outlook.com> (Alex Ng's message of "Sat, 6 Aug 2016 00:07:24 +0000")

"Alex Ng (LIS)" <alexng@microsoft.com> writes:

>> -----Original Message-----
>> From: Vitaly Kuznetsov [mailto:vkuznets@redhat.com]
>> Sent: Friday, August 5, 2016 3:49 AM
>> To: devel@linuxdriverproject.org
>> Cc: linux-kernel@vger.kernel.org; Haiyang Zhang <haiyangz@microsoft.com>;
>> KY Srinivasan <kys@microsoft.com>; Alex Ng (LIS) <alexng@microsoft.com>
>> Subject: [PATCH 2/4] Drivers: hv: balloon: account for gaps in hot add regions
>> 
>> I'm observing the following hot add requests from the WS2012 host:
>> 
>> hot_add_req: start_pfn = 0x108200 count = 330752
>> hot_add_req: start_pfn = 0x158e00 count = 193536
>> hot_add_req: start_pfn = 0x188400 count = 239616
>> 
>> As the host doesn't specify hot add regions we're trying to create 128Mb-
>> aligned region covering the first request, we create the 0x108000 -
>> 0x160000 region and we add 0x108000 - 0x158e00 memory. The second
>> request passes the pfn_covered() check, we enlarge the region to 0x108000 -
>> 0x190000 and add 0x158e00 - 0x188200 memory. The problem emerges with
>> the third request as it starts at 0x188400 so there is a 0x200 gap which is not
>> covered. As the end of our region is 0x190000 now it again passes the
>> pfn_covered() check were we just adjust the covered_end_pfn and make it
>> 0x188400 instead of 0x188200 which means that we'll try to online
>> 0x188200-0x188400 pages but these pages were never assigned to us and we
>> crash.
>
> The fact that the host sent a request that's non-contiguous with the previous
> request is unexpected. Could we check to see the number of pages we returned
> in our response, after each request?
>
> I'm wondering if we may have given a wrong response to cause the host to
> follow-up with a gapped request.

It seems it is not the case, here is the recorded session (address
format is hex, count is decimal):

[   66.851401] DM: hot_add_req: 108200 303104 0 0

-> we were asked to add 303104 pages ...

[   66.854420] DM: handle_pg_range: 108200 303104
[   84.489291] DM: handle_pg_range: return 303104
[   84.492498] DM: hot_add_req: ret 303104

-> and we returned '303104'

[  131.934542] DM: hot_add_req: 152200 221184 0 0

-> we were asked to add 221184 pages ...

[  131.937495] DM: handle_pg_range: 152200 221184
[  132.720390] DM: handle_pg_range: return 221184
[  132.722953] DM: hot_add_req: ret 221184

-> and we returned '221184'

[  132.958045] DM: hot_add_req: 188400 409088 0 0

-> and here we were asked to add pages with a gap (0x108200 + 303104 +
221184 = 0x188200 but as you can see the new range starts at 0x188400)

[  132.961409] DM: handle_pg_range: 188400 409088
[  134.012555] DM: handle_pg_range: return 409088
[  134.013862] DM: hot_add_req: ret 409088

so I don't see a flaw on Linux side ...

-- 
  Vitaly

  reply	other threads:[~2016-08-08  9:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-05 10:49 [PATCH 0/4] Drivers: hv: balloon: fix WS2012 memory hotplug issues and do some cleanup Vitaly Kuznetsov
2016-08-05 10:49 ` [PATCH 1/4] Drivers: hv: balloon: keep track of where ha_region starts Vitaly Kuznetsov
2016-08-05 10:49 ` [PATCH 2/4] Drivers: hv: balloon: account for gaps in hot add regions Vitaly Kuznetsov
2016-08-06  0:07   ` Alex Ng (LIS)
2016-08-08  9:38     ` Vitaly Kuznetsov [this message]
2016-08-05 10:49 ` [PATCH 3/4] Drivers: hv: balloon: get rid on ol_waitevent Vitaly Kuznetsov
2016-08-10 18:12   ` Alex Ng (LIS)
2016-08-11  9:18     ` Vitaly Kuznetsov
2016-08-05 10:49 ` [PATCH 4/4] Drivers: hv: balloon: replace ha_region_mutex with spinlock Vitaly Kuznetsov

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=87wpjrob24.fsf@vitty.brq.redhat.com \
    --to=vkuznets@redhat.com \
    --cc=alexng@microsoft.com \
    --cc=devel@linuxdriverproject.org \
    --cc=haiyangz@microsoft.com \
    --cc=kys@microsoft.com \
    --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 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.