Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751135AbdHWWY2 (ORCPT ); Wed, 23 Aug 2017 18:24:28 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:32327 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751003AbdHWWYZ (ORCPT ); Wed, 23 Aug 2017 18:24:25 -0400 From: Boris Ostrovsky To: jgross@suse.com Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, Boris Ostrovsky Subject: [PATCH] xen: Don't try to call xen_alloc_p2m_entry() on autotranslating guests Date: Wed, 23 Aug 2017 18:27:04 -0400 Message-Id: <1503527224-12390-1-git-send-email-boris.ostrovsky@oracle.com> X-Mailer: git-send-email 1.8.3.1 X-Source-IP: userv0021.oracle.com [156.151.31.71] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1197 Lines: 35 Commit aba831a69632 ("xen: remove tests for pvh mode in pure pv paths") removed XENFEAT_auto_translated_physmap test in xen_alloc_p2m_entry() since it is assumed that the routine is never called by non-PV guests. However, alloc_xenballooned_pages() may make this call on a PVH guest. Prevent this from happening by adding XENFEAT_auto_translated_physmap check there. Signed-off-by: Boris Ostrovsky Fixes: aba831a69632 ("xen: remove tests for pvh mode in pure pv paths") --- drivers/xen/balloon.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c index ab60925..f77e499 100644 --- a/drivers/xen/balloon.c +++ b/drivers/xen/balloon.c @@ -664,9 +664,11 @@ int alloc_xenballooned_pages(int nr_pages, struct page **pages) */ BUILD_BUG_ON(XEN_PAGE_SIZE != PAGE_SIZE); - ret = xen_alloc_p2m_entry(page_to_pfn(page)); - if (ret < 0) - goto out_undo; + if (!xen_feature(XENFEAT_auto_translated_physmap)) { + ret = xen_alloc_p2m_entry(page_to_pfn(page)); + if (ret < 0) + goto out_undo; + } #endif } else { ret = add_ballooned_pages(nr_pages - pgno); -- 1.8.3.1