From patchwork Fri Dec 9 15:48:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrzej Hajda X-Patchwork-Id: 31854 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp852232wrr; Fri, 9 Dec 2022 07:53:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf6y2e/VEPR9f+6pBx9kNBr09Hxk0K/IH9+oKSZCiqGEEHr7e/MLXfUlny4RQ9KRJ9TeMzHn X-Received: by 2002:a05:6a20:9c8f:b0:9d:efbf:6623 with SMTP id mj15-20020a056a209c8f00b0009defbf6623mr7873443pzb.49.1670601213156; Fri, 09 Dec 2022 07:53:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670601213; cv=none; d=google.com; s=arc-20160816; b=kXacJtiNKclF/kMDrnoLdpjDnFSq4F+H7RIevI6553pJ60fepKzSAmsN040U3IXnRR fIedyRKgjftERMxk+kb2ddT3nFsCY+WXfIiEUdh6nT3c/CZLwHjY88uu+GiSTBjZtwxI qgzVh/cZnOT4UjgUDXTc9fnkYVESltAsvUYw1HuyeBj9Jault6+Gw3OOVLoYrtiBqjaV 8H39jR8RHqJT1UBlkHgNHyYNJ05DCa8KT+vCCElJaTrZjLjnvn+vDP41Zx0WvoKD/UJS fOJwxeYHYDyspd4VyIPSesWjqDkzCyluiwfMCzBboqBUm3fJFjmZIDbv7ao0vSl7pgWI eqQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:organization :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7fUsUnAXepfKuE0su1ADZrvdwwtcafW5Ec0KIa2sKOo=; b=ZvdgpCVR+Z45oc4UKSKU9LtsitOI3ssiWawQ/QOCjaMKHm6ZVvbXS7YgZ3S1gp8AeM aADm8baUF90K/cJ6KA/92cdvI1yct7Y/hWjMEdAkWJ7NQc5mp9HSJRC2Q/nq+sptHP6O qvewBM5EjD06iHT+uf1VkbzLpokCyWwSgw9C5bTH/s9vkvN80HInpy9WynN7P2HLfEo/ 5egjtbV0ugYPKqfJ6SBMU6hTSGCn/Q2dO9gjiyxQFROfdJfEtHm+bA0AuMWIrNLcWmzj JZ2XxzQVqVF6f2ItViNDhsI7sBYOV/81aKjdylBZ8C8mbP+JAucjWV/HaNvK3SiJh3Rl Vs3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=aKfC4IUf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 31-20020a63135f000000b00478aec5f39esi1604551pgt.834.2022.12.09.07.53.19; Fri, 09 Dec 2022 07:53:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=aKfC4IUf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230523AbiLIPu4 (ORCPT + 99 others); Fri, 9 Dec 2022 10:50:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38670 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230487AbiLIPuS (ORCPT ); Fri, 9 Dec 2022 10:50:18 -0500 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A0715592 for ; Fri, 9 Dec 2022 07:49:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1670600967; x=1702136967; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1d8DO0y4KPCKgk9FowYpGZO4PZW2hY3vRExtJAWw+og=; b=aKfC4IUfiXqYG3Muegn8D/hqmtTVgOqXtRLb+ExPos64pz8Juhqvuby+ k/Uh5NuddsquRjAyMMqRiXsp0puronfPfoSPhuDQ+rs85/T66YpxRoKyB /Fr8rwQYvy675ZeowBH6gCWCRIYXx0YBN/V5RkmGvokASDNvYtq9bvKhN XXdsvXOPblCu06YFzKbBRlJnff28BGPA2sDxmsKH/TxVMzRE9BG6N3TsD k2wSPPsgrCWzo23uJE1liLkwG4Oo2iHkDdz5RB2BLZmIB5WoJZEFsemmC TlBtNCZoH1dUhQxe1VrKp/EVxeCp9xlwqN2AC9ZTdd8/E4uN396Z3iTt1 w==; X-IronPort-AV: E=McAfee;i="6500,9779,10556"; a="315119821" X-IronPort-AV: E=Sophos;i="5.96,230,1665471600"; d="scan'208";a="315119821" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Dec 2022 07:49:27 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10556"; a="647433368" X-IronPort-AV: E=Sophos;i="5.96,230,1665471600"; d="scan'208";a="647433368" Received: from lab-ah.igk.intel.com ([10.91.215.196]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Dec 2022 07:49:23 -0800 From: Andrzej Hajda To: linux-kernel@vger.kernel.org, intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: Andrzej Hajda , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin , Andi Shyti , Andrew Morton , Andy Shevchenko , Arnd Bergmann Subject: [PATCH 4/5] drm/i915/gvt: kill fetch_and_zero usage Date: Fri, 9 Dec 2022 16:48:42 +0100 Message-Id: <20221209154843.4162814-4-andrzej.hajda@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221209154843.4162814-1-andrzej.hajda@intel.com> References: <20221209154843.4162814-1-andrzej.hajda@intel.com> MIME-Version: 1.0 Organization: Intel Technology Poland sp. z o.o. - ul. Slowackiego 173, 80-298 Gdansk - KRS 101882 - NIP 957-07-52-316 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751752337900544356?= X-GMAIL-MSGID: =?utf-8?q?1751752337900544356?= Better use recently introduced kernel core helper. Signed-off-by: Andrzej Hajda --- drivers/gpu/drm/i915/gvt/kvmgt.c | 2 +- drivers/gpu/drm/i915/gvt/scheduler.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c index 077892a9aa8fdc..061302abb0a189 100644 --- a/drivers/gpu/drm/i915/gvt/kvmgt.c +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c @@ -1831,7 +1831,7 @@ static int init_service_thread(struct intel_gvt *gvt) */ static void intel_gvt_clean_device(struct drm_i915_private *i915) { - struct intel_gvt *gvt = fetch_and_zero(&i915->gvt); + struct intel_gvt *gvt = exchange(&i915->gvt, NULL); if (drm_WARN_ON(&i915->drm, !gvt)) return; diff --git a/drivers/gpu/drm/i915/gvt/scheduler.c b/drivers/gpu/drm/i915/gvt/scheduler.c index 9cd8fcbf7cad16..6699135f366f3f 100644 --- a/drivers/gpu/drm/i915/gvt/scheduler.c +++ b/drivers/gpu/drm/i915/gvt/scheduler.c @@ -826,7 +826,7 @@ static int dispatch_workload(struct intel_vgpu_workload *workload) /* We might still need to add request with * clean ctx to retire it properly.. */ - rq = fetch_and_zero(&workload->req); + rq = exchange(&workload->req, NULL); i915_request_put(rq); } @@ -1103,7 +1103,7 @@ static void complete_current_workload(struct intel_gvt *gvt, int ring_id) intel_vgpu_trigger_virtual_event(vgpu, event); } - i915_request_put(fetch_and_zero(&workload->req)); + i915_request_put(exchange(&workload->req, 0)); } gvt_dbg_sched("ring id %d complete workload %p status %d\n",