From patchwork Mon Aug 8 23:56:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tamas Lengyel X-Patchwork-Id: 9270001 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D56AD60754 for ; Tue, 9 Aug 2016 00:00:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C6DF32818B for ; Tue, 9 Aug 2016 00:00:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB54E281C3; Tue, 9 Aug 2016 00:00:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 403DF2818B for ; Tue, 9 Aug 2016 00:00:14 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bWuPr-0007zz-Ak; Mon, 08 Aug 2016 23:57:07 +0000 Received: from mail6.bemta6.messagelabs.com ([85.158.143.247]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bWuPq-0007zt-2p for xen-devel@lists.xenproject.org; Mon, 08 Aug 2016 23:57:06 +0000 Received: from [193.109.254.147] by server-1.bemta-6.messagelabs.com id 24/39-21406-15C19A75; Mon, 08 Aug 2016 23:57:05 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprAIsWRWlGSWpSXmKPExsVyMfT+Yd0AmZX hBoff6Ft83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBl7eycwFlzhrZhz/jp7A+NCri5GTg4hgZmM EssWO4HYLAJvWCQurREEsSUE3rFInPkd0sXIAWTHSCybrA4RLpf4c/8rK0SrpsTBDWeYIex+J on+3hQQm03ASOLq1R42EFtEQEni3qrJTF2MXBzMAk1MEm9+/2cESQgLBEk0fFnJDLFXVWJ9I0 ScV8BTouHrZHaIZXISl6c/YJvAyLeAkWEVo3pxalFZapGuhV5SUWZ6RkluYmaOrqGBmV5uanF xYnpqTmJSsV5yfu4mRmCIMADBDsbZl/0PMUpyMCmJ8spPXREuxJeUn1KZkVicEV9UmpNafIhR hoNDSYI3Q2pluJBgUWp6akVaZg4wWGHSEhw8SiK8O0DSvMUFibnFmekQqVOMlhxbfl9by8SxZ cENILlt6r21TEIsefl5qVLivAYgDQIgDRmleXDjYBF1iVFWSpiXEehAIZ6C1KLczBJU+VeM4h yMSsK850Gm8GTmlcBtfQV0EBPQQUmqK0AOKklESEk1MPKx8eRNn/zkpc1FgRV/9TStm8+GKs9 92lk4o6wpujakYQK3sar01oiTl5nTnYS1RWMt569t09corf866+vxb5eO3V5v23HqcfOl3wLO TVYJX48ebfB+zROunOx1zNprgs4Hpdk5ClpbOeM/NkjpM52eJR3Mta7R6tx5GzUn/5a7D1deU pZ+rcRSnJFoqMVcVJwIALQtSQmjAgAA X-Env-Sender: tamas.lengyel@zentific.com X-Msg-Ref: server-14.tower-27.messagelabs.com!1470700623!40447805!1 X-Originating-IP: [209.85.223.195] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 8.77; banners=-,-,- X-VirusChecked: Checked Received: (qmail 39900 invoked from network); 8 Aug 2016 23:57:04 -0000 Received: from mail-io0-f195.google.com (HELO mail-io0-f195.google.com) (209.85.223.195) by server-14.tower-27.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 8 Aug 2016 23:57:04 -0000 Received: by mail-io0-f195.google.com with SMTP id q83so29784054iod.2 for ; Mon, 08 Aug 2016 16:57:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zentific-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=MGFnVuz5JEgJC3P6hfIT5a8HfpXMfkOuK69F2NMg7xs=; b=RYzq8CCHQ1Bm3wNaCqIRH6/V040KUHwkTeWL6nlGTFJEutoV4p1G99zP/b2Ex8UpCQ KGNfhWhN8pkXjd9r3uZr+uXh4o0mFAtMLZ7FMD+H/o/AQXiQ3+j3dNjHPmQcpFHCQfo3 iUbKJKy8Xp3TJUrQ9yjFtetgD6e0JSGGLZbgVQN2AUmdhZRmW7cqDbwAxPa2vUcMRUL3 bIWzm4n1CElosSQBH9RMDxQku75XDtugnuRq4I54JedqWMd4AaQQ1qaHwwzTEa8hd3VR hrQ4qVu/MXyzJi7z1iNcIzk7lQ7anBL/ne7PLlNwyShHU7qVioYMOud1BVmtBy4KXma3 3KqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=MGFnVuz5JEgJC3P6hfIT5a8HfpXMfkOuK69F2NMg7xs=; b=cVlAofW3YyDhqvUdTLHiN9TQ5NIb4viblj9sSNMPusE+2tvY38ZoW4ToA/ERATRAfc mmj4mFi7ym5t2Iv9LVWOxfg9ofz7ekBfntn5Z+4cIrAoxOlPMJM88bmmCfzLh3yN6GVY 0tSSirUotrQcVWUoQyiFhQHvfuEJfHEFQP2QErl2hoWUegq7GdCGc7STOk2Pi+wKcedv Q8IzhhHvFuzKDwZPZZYMlfRieH0EnzckRyXKpS1NXpYT1KTWpypXHNQzo/KN8NOXVjFo Mr4TeUgZs8TSDiFywZ7kC3vB/pLFTWTsd8Zhrgh6UY8Bwsz3j7xd7OTNjRrHh0lD53Ei xVzQ== X-Gm-Message-State: AEkoousPUv9ZPe8nSGAIKtD0TweWHnsLH3X+iHXm5oAQwHFxJOUF2Eq3PRIyQ81svmSNuQ== X-Received: by 10.107.3.35 with SMTP id 35mr97168456iod.40.1470700623279; Mon, 08 Aug 2016 16:57:03 -0700 (PDT) Received: from l1.lan (c-73-14-35-59.hsd1.co.comcast.net. [73.14.35.59]) by smtp.gmail.com with ESMTPSA id o5sm271503ith.20.2016.08.08.16.57.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Aug 2016 16:57:02 -0700 (PDT) From: Tamas K Lengyel To: xen-devel@lists.xenproject.org Date: Mon, 8 Aug 2016 17:56:58 -0600 Message-Id: <1470700619-7521-1-git-send-email-tamas.lengyel@zentific.com> X-Mailer: git-send-email 2.8.1 Cc: Tamas K Lengyel , Razvan Cojocaru , George Dunlap , Tamas K Lengyel , Jan Beulich , Andrew Cooper Subject: [Xen-devel] [PATCH 1/2] x86/altp2m: use __get_gfn_type_access to avoid lock conflicts X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Tamas K Lengyel Use __get_gfn_type_access instead of get_gfn_type_access when checking the hostp2m entries during altp2m mem_access setting and gfn remapping to avoid a lock conflict which can make dom0 freeze. Signed-off-by: Tamas K Lengyel Reviewed-by: Razvan Cojocaru --- Cc: George Dunlap Cc: Jan Beulich Cc: Andrew Cooper Cc: Razvan Cojocaru --- xen/arch/x86/mm/p2m.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index 812dbf6..fb1fda4 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -1787,8 +1787,8 @@ int p2m_set_altp2m_mem_access(struct domain *d, struct p2m_domain *hp2m, if ( !mfn_valid(mfn) ) { - mfn = get_gfn_type_access(hp2m, gfn_l, &t, &old_a, - P2M_ALLOC | P2M_UNSHARE, &page_order); + mfn = __get_gfn_type_access(hp2m, gfn_l, &t, &old_a, + P2M_ALLOC | P2M_UNSHARE, &page_order, 0); rc = -ESRCH; if ( !mfn_valid(mfn) || t != p2m_ram_rw ) @@ -2563,8 +2563,8 @@ int p2m_change_altp2m_gfn(struct domain *d, unsigned int idx, /* Check host p2m if no valid entry in alternate */ if ( !mfn_valid(mfn) ) { - mfn = get_gfn_type_access(hp2m, gfn_x(old_gfn), &t, &a, - P2M_ALLOC | P2M_UNSHARE, &page_order); + mfn = __get_gfn_type_access(hp2m, gfn_x(old_gfn), &t, &a, + P2M_ALLOC | P2M_UNSHARE, &page_order, 0); if ( !mfn_valid(mfn) || t != p2m_ram_rw ) goto out;