Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2477995yba; Mon, 15 Apr 2019 12:28:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqxYLJrJWCRG9TOoQAL17HhaUFeFY2ZcNEtVIB5rtj4QAUEnie7WMAOP6FAd4FCO3s8O8x7R X-Received: by 2002:a17:902:bc48:: with SMTP id t8mr15923882plz.65.1555356531705; Mon, 15 Apr 2019 12:28:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555356531; cv=none; d=google.com; s=arc-20160816; b=bFxILpTT3IA4Jf3YT0cP5vLnuBJBkLlcgbaIU52Er1GgZi0w3UGPMJNYi+ZXrGoYZ4 6asV8WYBMQMD/O3xounFI64zvDMZWeVEuQi4I9qVJxMhviJIkQv2+l1K6WRrUoknXxRe 4Be1YFYX0rUUSWhoRwrHCu6gD9ulsgbnlQzZVVc+O/N0qII9XAEpOZLDGyTxt9xqWqHr L56yUwEF1Jqll5U45kSTXKSFlFN8w/zCuExlDVowW+fePWqHA22JWqQ2nSdGtP2rs7Ki eLm8gx+O89gRQB2O9tdeBpwn3pn579PAG1zQWmdcGlwjvFE7YUi9hA3tdVndPWdtXbHT 1HnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=of8F1vtg1BT+3Ss3qN9OEsL5FsgGfq1BEztvo9Rf2RU=; b=tVbplCT5ThZKMVx3znDg8rB6Vb/rqr+EeRTYrNmY2a1TKIyb8N/GJOUcmVXDPl8H4D fGksx/1oFNkvC6H9PsPWro2NYaotuaMKUSUBQHGOGdX1nCYUDyrFkST7ux0jCB07wnRT ygQPlN/1o+DTXmdj53RnFm5GBxKcTNGgAYjhdTbyNIcS9D8JL5GMGrMtyU3WwCQh2Q1O 5xd2kdVuIfofPicuSkbHo/R9NXm6aqXpxP934p0BG4/ukfjcvQ5OEjeQ6AIvuNivrnEG bDZI+BPVPakGbNVkHRGupmNcRlQlv5jeYahfHQR7ErMImwbLMDR3dlL7F0yzdrVO7kSy 9K8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zEih1oFy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d14si45847335pgb.26.2019.04.15.12.28.35; Mon, 15 Apr 2019 12:28:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=zEih1oFy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730033AbfDOT0F (ORCPT + 99 others); Mon, 15 Apr 2019 15:26:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:38348 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729091AbfDOTE6 (ORCPT ); Mon, 15 Apr 2019 15:04:58 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6DEAD218D3; Mon, 15 Apr 2019 19:04:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555355097; bh=GmMeTWL6zzAz/YDdIDycDCUTqM0lVieesu7BK+dA4oI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zEih1oFyvOlQbiBfGTu4Xzrw38QP1vlCrLQYp8pljATwRJhrmu3IrIEMgYG9FloPp kS+Y1p3Xg44iUV1niVsEX3YjLqPkJwl4wM3K1hhXM0SwpT4gvQQqukgQzSO/GM9hzE SKwuJ4hhczsU+Nx8mW2w/xsh8gW2mVofl5UXAMOM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, zhenyuw@linux.intel.com, Yan Zhao , Sasha Levin Subject: [PATCH 4.19 002/101] drm/i915/gvt: do not let pin count of shadow mm go negative Date: Mon, 15 Apr 2019 20:58:00 +0200 Message-Id: <20190415183740.470704316@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183740.341577907@linuxfoundation.org> References: <20190415183740.341577907@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit 663a50ceac75c2208d2ad95365bc8382fd42f44d ] shadow mm's pin count got increased in workload preparation phase, which is after workload scanning. it will get decreased in complete_current_workload() anyway after workload completion. Sometimes, if a workload meets a scanning error, its shadow mm pin count will not get increased but will get decreased in the end. This patch lets shadow mm's pin count not go below 0. Fixes: 2707e4446688 ("drm/i915/gvt: vGPU graphics memory virtualization") Cc: zhenyuw@linux.intel.com Cc: stable@vger.kernel.org #4.14+ Signed-off-by: Yan Zhao Signed-off-by: Zhenyu Wang Signed-off-by: Sasha Levin --- drivers/gpu/drm/i915/gvt/gtt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gvt/gtt.c b/drivers/gpu/drm/i915/gvt/gtt.c index 00aad8164dec..542f31ce108f 100644 --- a/drivers/gpu/drm/i915/gvt/gtt.c +++ b/drivers/gpu/drm/i915/gvt/gtt.c @@ -1940,7 +1940,7 @@ void _intel_vgpu_mm_release(struct kref *mm_ref) */ void intel_vgpu_unpin_mm(struct intel_vgpu_mm *mm) { - atomic_dec(&mm->pincount); + atomic_dec_if_positive(&mm->pincount); } /** -- 2.19.1