From patchwork Tue Nov 19 12:08:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony PERARD X-Patchwork-Id: 11251821 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F3C76930 for ; Tue, 19 Nov 2019 12:10:36 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CFDD4222D1 for ; Tue, 19 Nov 2019 12:10:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="hvAGNjDu" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CFDD4222D1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iX2Je-0003jj-7m; Tue, 19 Nov 2019 12:09:06 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iX2Jc-0003je-V8 for xen-devel@lists.xenproject.org; Tue, 19 Nov 2019 12:09:05 +0000 X-Inumbo-ID: 599a33cc-0ac5-11ea-a2f9-12813bfff9fa Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 599a33cc-0ac5-11ea-a2f9-12813bfff9fa; Tue, 19 Nov 2019 12:08:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1574165331; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=0ZmOn2G3sznXMWFupB29G58F8HtaQfg2sCdZtBYjYas=; b=hvAGNjDuVlrjgW5fEDIqzKLo5rBycO7wEJtsNmcBAm79u/9lV62Q1Q/l sfzbOdboi0Z8NTfLjAjsA6xnoWU2cHwHt+MbKKzYla1bwhNoSaH4Bo2Vj Zy9F0hM8tfrPwy90X8w7oD6qIw+UVkEXlUbdyGKLnylakwpNs+Qqa6dLm w=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=anthony.perard@citrix.com; spf=Pass smtp.mailfrom=anthony.perard@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of anthony.perard@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa4.hc3370-68.iphmx.com: domain of anthony.perard@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="anthony.perard@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa4.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa4.hc3370-68.iphmx.com; envelope-from="anthony.perard@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: cY9jv+g8HvDunovBhPKwoWBykgDSkAtmLwdqBXyidts/YxK92TM9GKgXhk9XC0Qv5iR5aSpEtJ 0r+8NwqV79teo8UmUBLq4GdrP7N+ltLJt1zS/yRe9BVf4ioyfgnPHANJ07ElkyMTdbCS4AP895 AKw/KPaXwQKtXJjMTnSUu54TTgkTmoYwgH+CvLUsZFN/4+q1MDpNg+Uges5TN98PGXCMokqYXz dmHsUYttWkW2NbF9Y39Ip+T0OhEekybltKCPxMyde3OnyuYOdan+opBDuITffqoZJrvmJlF99j A5c= X-SBRS: 2.7 X-MesageID: 9056611 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.68,322,1569297600"; d="scan'208";a="9056611" From: Anthony PERARD To: Date: Tue, 19 Nov 2019 12:08:49 +0000 Message-ID: <20191119120849.1547072-1-anthony.perard@citrix.com> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Subject: [Xen-devel] [XEN PATCH] x86/domctl: Have XEN_DOMCTL_getpageframeinfo3 preemptible X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Anthony PERARD , Andrew Cooper , Jan Beulich , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" This hypercall can take a long time to finish because it attempts to grab the `hostp2m' lock up to 1024 times. The accumulated wait for the lock can take several seconds. This can easily happen with a guest with 32 vcpus and plenty of RAM, during localhost migration. Signed-off-by: Anthony PERARD --- Notes: I don't know if it's a correct way to make the hypercall preemptible, the patch kind of modify the response, but libxc doesn't seems to care. Is it fine to modify the domctl_t that the domain (dom0) provides? If not, where could we store the progress made? xen/arch/x86/domctl.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/xen/arch/x86/domctl.c b/xen/arch/x86/domctl.c index 43e368d63bb9..5c0a7462e63b 100644 --- a/xen/arch/x86/domctl.c +++ b/xen/arch/x86/domctl.c @@ -425,6 +425,18 @@ long arch_do_domctl( ret = -EFAULT; break; } + + if ( hypercall_preempt_check() ) { + domctl->u.getpageframeinfo3.num = num - i - 1; + domctl->u.getpageframeinfo3.array.p = + guest_handle + ((i + 1) * width); + if ( __copy_to_guest(u_domctl, domctl, 1) ) { + ret = -EFAULT; + break; + } + return hypercall_create_continuation(__HYPERVISOR_domctl, + "h", u_domctl); + } } break;