From patchwork Wed Dec 23 08:25:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quan Xu X-Patchwork-Id: 7909021 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 1CDBF9F1AF for ; Wed, 23 Dec 2015 08:29:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2AA3E20108 for ; Wed, 23 Dec 2015 08:29:36 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 12173203C4 for ; Wed, 23 Dec 2015 08:29:35 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aBekZ-0005B9-3r; Wed, 23 Dec 2015 08:26:23 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aBekX-0005Ai-IF for xen-devel@lists.xen.org; Wed, 23 Dec 2015 08:26:21 +0000 Received: from [85.158.143.35] by server-2.bemta-4.messagelabs.com id 27/49-18316-CAA5A765; Wed, 23 Dec 2015 08:26:20 +0000 X-Env-Sender: quan.xu@intel.com X-Msg-Ref: server-9.tower-21.messagelabs.com!1450859177!6817683!1 X-Originating-IP: [192.55.52.120] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 45768 invoked from network); 23 Dec 2015 08:26:18 -0000 Received: from mga04.intel.com (HELO mga04.intel.com) (192.55.52.120) by server-9.tower-21.messagelabs.com with SMTP; 23 Dec 2015 08:26:18 -0000 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga104.fm.intel.com with ESMTP; 23 Dec 2015 00:26:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,467,1444719600"; d="scan'208";a="877317138" Received: from xen-commits.sh.intel.com ([10.239.82.178]) by orsmga002.jf.intel.com with ESMTP; 23 Dec 2015 00:26:13 -0800 From: Quan Xu To: jbeulich@suse.com, kevin.tian@intel.com Date: Wed, 23 Dec 2015 16:25:35 +0800 Message-Id: <1450859136-98482-3-git-send-email-quan.xu@intel.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1450859136-98482-1-git-send-email-quan.xu@intel.com> References: <1450859136-98482-1-git-send-email-quan.xu@intel.com> Cc: feng.wu@intel.com, eddie.dong@intel.com, george.dunlap@eu.citrix.com, andrew.cooper3@citrix.com, tim@xen.org, xen-devel@lists.xen.org, jun.nakajima@intel.com, Quan Xu , keir@xen.org Subject: [Xen-devel] [PATCH v4 2/3] VT-d: Reduce spin timeout to 1ms, which can be boot-time changed. X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Quan Xu Acked-by: Kevin Tian --- xen/drivers/passthrough/vtd/qinval.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/xen/drivers/passthrough/vtd/qinval.c b/xen/drivers/passthrough/vtd/qinval.c index 946e812..b227e4e 100644 --- a/xen/drivers/passthrough/vtd/qinval.c +++ b/xen/drivers/passthrough/vtd/qinval.c @@ -28,6 +28,11 @@ #include "vtd.h" #include "extern.h" +static int __read_mostly iommu_qi_timeout_ms = 1; +integer_param("iommu_qi_timeout_ms", iommu_qi_timeout_ms); + +#define IOMMU_QI_TIMEOUT (iommu_qi_timeout_ms * MILLISECS(1)) + static void print_qi_regs(struct iommu *iommu) { u64 val; @@ -167,10 +172,12 @@ static int queue_invalidate_wait(struct iommu *iommu, start_time = NOW(); while ( poll_slot != QINVAL_STAT_DONE ) { - if ( NOW() > (start_time + DMAR_OPERATION_TIMEOUT) ) + if ( NOW() > (start_time + IOMMU_QI_TIMEOUT) ) { print_qi_regs(iommu); - panic("queue invalidate wait descriptor was not executed"); + dprintk(XENLOG_WARNING VTDPREFIX, + "Queue invalidate wait descriptor was timeout.\n"); + return -ETIMEDOUT; } cpu_relax(); }