Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2456952yba; Mon, 15 Apr 2019 12:03:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqxuiLsXkfZimsRP0tV0F6PLoRm0kUInL3+BazcdL2iX3WUruyg6ZaNCUu2J+XeXfWylcMzI X-Received: by 2002:a63:e850:: with SMTP id a16mr68605143pgk.195.1555354987473; Mon, 15 Apr 2019 12:03:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555354987; cv=none; d=google.com; s=arc-20160816; b=Kq+oIV6UpOtS5JipG431M/28J6C2tt5tmsJfjrgcVrUXX3Ev8zCC3Grf1Uf1xfWiI7 iiMjv+/EPHnjgLh44RxP7+kwKCgsSrpMdS+ZYF2NW0dvKO1o5ioJzZKkMA6PnViKRAJb KLdeU/wotlixbp1CiJt161dHABCUUrJOYTKTVecD+s24YwrlMpD4/97JVY8sN0EOjjWk 9Tr8Rp4/TswH/UjZDGlqfWMUC3nVFt3C7Z5Dt8NudvnLJ/q17hm13kU+QdFS3hw4ExDD e6ahCA3dvegmpMcT9doJmVJWNylfXIudL43RozbB/uGF+zFInPSDbqlxebK4dYHdH8ti 8Vxw== 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=l08lLx3n7oWlZoZZAg/BtZ6mUWUBoeimrYkvspBmZlU=; b=IZBkZcaamFn7dFmRhAE4V9Wf3tqlY2RkOE8kmFXAFKz7l50SlUfL/icY6GnoRdCNnP 9Z46M3UgKW/9DKGi/5i5m8Hcr6O8RuU2q2fMUW3PBvdGh3ZWa7l2AxnOIbGrzdLGFcG+ brx5u34TEjAgvgdWdR/FRmk4FifKmQd7rK+lSUJ2xF1wLLS4XOixOWMBu6hUBa5XUDEl IDIXAqBFA+N51E577+UCMqSDVcoCN+ghWo637aiopg6W4/m4/HSwXq7d5WTDpOPdeBGO z3YWv8rxkCuNOJsn7fFp80i5dMYiMbc+mSWhGQWqWyhB8VxGX4MOo+JVuFjanLH9a6jC HClA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="O4W/fX1o"; 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 h11si44299427pgp.391.2019.04.15.12.02.50; Mon, 15 Apr 2019 12:03:07 -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="O4W/fX1o"; 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 S1728470AbfDOTCC (ORCPT + 99 others); Mon, 15 Apr 2019 15:02:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:60712 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728419AbfDOTCA (ORCPT ); Mon, 15 Apr 2019 15:02:00 -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 BDB0E20880; Mon, 15 Apr 2019 19:01:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1555354919; bh=SXUxFNZnUslD8JfWuQMUnvk0n8/vG+XfcL6nCQfcYq4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=O4W/fX1oQutoG5UQqRtvo/hPq9m8eLs+vsAEpoLKFOIEEkUwLOXta9xZcYtboKNEM B4hcr/7uKp7z6CTEv5s6me5j2xb42RsNFE9QCGBndlbqe1y9Qq5LoUIQnHdgedYZeb vUqebJeaE3TEqDo5cUkKA32gKfgeKASBR4Y0+JQE= 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.14 06/69] drm/i915/gvt: do not let pin count of shadow mm go negative Date: Mon, 15 Apr 2019 20:58:24 +0200 Message-Id: <20190415183727.932389730@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190415183726.036654568@linuxfoundation.org> References: <20190415183726.036654568@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 dadacbe558ab..1a1f7eb46d1e 100644 --- a/drivers/gpu/drm/i915/gvt/gtt.c +++ b/drivers/gpu/drm/i915/gvt/gtt.c @@ -1629,7 +1629,7 @@ void intel_vgpu_unpin_mm(struct intel_vgpu_mm *mm) if (WARN_ON(mm->type != INTEL_GVT_MM_PPGTT)) return; - atomic_dec(&mm->pincount); + atomic_dec_if_positive(&mm->pincount); } /** -- 2.19.1