Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp405449pxb; Mon, 13 Sep 2021 23:25:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUsC5bCw+zHsFJcEtKlDt2P8lpaap7cU4/v6HKZYS/++IcUDQQh1Zip4xaDyqj2FJ+Gv1a X-Received: by 2002:a17:907:2d2b:: with SMTP id gs43mr16912043ejc.437.1631600744812; Mon, 13 Sep 2021 23:25:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631600744; cv=none; d=google.com; s=arc-20160816; b=iuGBU7DJNeYcUv6cG+8mUcr2RjoLyZQD3M2IVG00t+Po1W4B8fg/eJoZkwETLOczf+ sozWHxJx+9y9SksJsVoFpePkKryNm+nby/ykSCt9atLoAda5Nrk0WdhS8blO7vwyJ73c vBtuJgwm7b43a+WMTnriErCtaLjBJb5V9ZehWnN0CtSZa03IfzQMX1Ri+x+9zff3O4WU MxGXajD/MQMNQqMRWCN5IJRRBEVAO1TZLdXGbS8A9KKcAgKik0+mCN4ULltwgeEzHrHu BYOgiCWN/MUoXjQlYTNG4pDG60g9FjpfdEs7sSxaaThk3KqpkHe1iG1DLZuEWo3xUOvC 03Pg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Re+KaFJbho1jNjbhRke2ib7p7aV9jdzfPzi+y8DnrHo=; b=XatXoMFKo7wSK8EccPpLlafFK5E60qpdYWMCsC8IjGB6BRJIpsOPz9NGmoq8tXCng4 T4s5y+vxUeI4Sc6GgkTVRO+SybgGvIOIDSTVHtJffPbqVsS+aR5MN6A14LmdhDBUMfF+ MK9SnHPqqpVpJpWNErzqT4Jylob8PjOYzN72fsrpMhi89wqqOQmtFq42N92tNSWzGOwZ 9qcGoXtCiRTl/EqCCFRmukrUE1ae/XEp8royyerVM0U5hwmVDAqZGW4gk9SFQCnvpPS5 3NpYxJ4iMDkY3zM5CyEsLgBxq5vgFy2MNhazWzQn9nAbOS6tWhcaZQTIORoJEzBNibCH vdhw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e4si9977444ejk.72.2021.09.13.23.25.17; Mon, 13 Sep 2021 23:25:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240119AbhINGZP (ORCPT + 99 others); Tue, 14 Sep 2021 02:25:15 -0400 Received: from mail.loongson.cn ([114.242.206.163]:46662 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S239908AbhINGZO (ORCPT ); Tue, 14 Sep 2021 02:25:14 -0400 Received: from localhost.localdomain (unknown [10.2.5.180]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9DxH2v4P0Bh3U0GAA--.10627S3; Tue, 14 Sep 2021 14:23:52 +0800 (CST) From: bibo mao To: Dave Airlie , Gerd Hoffmann Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH 2/2] drm/qxl: Add qxl dma fence release function Date: Tue, 14 Sep 2021 02:23:52 -0400 Message-Id: <20210914062352.6102-2-maobibo@loongson.cn> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20210914062352.6102-1-maobibo@loongson.cn> References: <20210914062352.6102-1-maobibo@loongson.cn> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: AQ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r0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07b0PEfUUUUU= X-CM-SenderInfo: xpdruxter6z05rqj20fqof0/ Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add qxl dma fence release function, previously default dma fence release function is used, and fence pointer is used to free the memory. With this patch, actual qxl release pointer is used to free memory, so that dma fence can put at any place of struct qxl_release. Signed-off-by: bibo mao --- drivers/gpu/drm/qxl/qxl_release.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/gpu/drm/qxl/qxl_release.c b/drivers/gpu/drm/qxl/qxl_release.c index 469979cd0341..a9724857c526 100644 --- a/drivers/gpu/drm/qxl/qxl_release.c +++ b/drivers/gpu/drm/qxl/qxl_release.c @@ -74,10 +74,25 @@ static long qxl_fence_wait(struct dma_fence *fence, bool intr, return end - cur; } +static void qxl_fence_release_rcu(struct rcu_head *rcu) +{ + struct dma_fence *fence = container_of(rcu, struct dma_fence, rcu); + struct qxl_release *release; + + release = container_of(fence, struct qxl_release, base); + kfree(release); +} + +static void qxl_fence_release(struct dma_fence *fence) +{ + call_rcu(&fence->rcu, qxl_fence_release_rcu); +} + static const struct dma_fence_ops qxl_fence_ops = { .get_driver_name = qxl_get_driver_name, .get_timeline_name = qxl_get_timeline_name, .wait = qxl_fence_wait, + .release = qxl_fence_release, }; static int -- 2.27.0