From patchwork Thu Feb 21 18:41:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 10825459 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 229821390 for ; Fri, 22 Feb 2019 08:21:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1437931B2B for ; Fri, 22 Feb 2019 08:21:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 089B531B1C; Fri, 22 Feb 2019 08:21:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B1B0A31B29 for ; Fri, 22 Feb 2019 08:21:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id ED86F8935C; Fri, 22 Feb 2019 08:20:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) by gabe.freedesktop.org (Postfix) with ESMTPS id DBCB389115 for ; Thu, 21 Feb 2019 18:42:34 +0000 (UTC) Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gwtIo-0000g2-Em; Thu, 21 Feb 2019 18:42:34 +0000 From: Matthew Wilcox To: dri-devel@lists.freedesktop.org Subject: [PATCH 20/34] drm/i915: Convert page_track_tree to XArray Date: Thu, 21 Feb 2019 10:41:59 -0800 Message-Id: <20190221184226.2149-40-willy@infradead.org> X-Mailer: git-send-email 2.14.5 In-Reply-To: <20190221184226.2149-1-willy@infradead.org> References: <20190221184226.2149-1-willy@infradead.org> X-Mailman-Approved-At: Fri, 22 Feb 2019 08:20:52 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=mUUKTyL3L4YemQHUydUoRkWgijgR5Cw8P24CoXQNlUM=; b=FfMpXsMtuEnGMe4KAYy5QeC+S eJ4OOsQ0bJj/XZheFRDDb01l6gCde3ZHzZZxLeU2nX57VvzEIr5Ls4eQSUa3RH4sJCZkp4vCP4ayg y2eEURNKDAmPRloqvpIkvmXD+5An4oZEu6IWcBBRx0d4SnBO9VTeiTP86c+1Y6sdvWn+vrLwFlpds kudAziWoY2OvR63F6hb1wHLNUidT7Ldzml2zxZBXFsr9VoM7Bce6gdn4fH/t05+TIJ6AzJ2desXpR CcPUpsmSm7D2fiS2LNQekPOWbZDR56uFh7u13TuT2VIOXAKhmiJdVxVb627wroLdw40CAzwGi5MSL 27WvK/T6g==; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matthew Wilcox MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP No locking changes. Signed-off-by: Matthew Wilcox --- drivers/gpu/drm/i915/gvt/gvt.h | 2 +- drivers/gpu/drm/i915/gvt/page_track.c | 6 +++--- drivers/gpu/drm/i915/gvt/vgpu.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/gvt/gvt.h b/drivers/gpu/drm/i915/gvt/gvt.h index b4ab1dad0143..e5bf20dcdd7d 100644 --- a/drivers/gpu/drm/i915/gvt/gvt.h +++ b/drivers/gpu/drm/i915/gvt/gvt.h @@ -198,7 +198,7 @@ struct intel_vgpu { struct intel_vgpu_opregion opregion; struct intel_vgpu_display display; struct intel_vgpu_submission submission; - struct radix_tree_root page_track_tree; + struct xarray page_track; u32 hws_pga[I915_NUM_ENGINES]; struct dentry *debugfs; diff --git a/drivers/gpu/drm/i915/gvt/page_track.c b/drivers/gpu/drm/i915/gvt/page_track.c index 84856022528e..8e8b5935f344 100644 --- a/drivers/gpu/drm/i915/gvt/page_track.c +++ b/drivers/gpu/drm/i915/gvt/page_track.c @@ -34,7 +34,7 @@ struct intel_vgpu_page_track *intel_vgpu_find_page_track( struct intel_vgpu *vgpu, unsigned long gfn) { - return radix_tree_lookup(&vgpu->page_track_tree, gfn); + return xa_load(&vgpu->page_track, gfn); } /** @@ -64,7 +64,7 @@ int intel_vgpu_register_page_track(struct intel_vgpu *vgpu, unsigned long gfn, track->handler = handler; track->priv_data = priv; - ret = radix_tree_insert(&vgpu->page_track_tree, gfn, track); + ret = xa_err(xa_store(&vgpu->page_track, gfn, track, GFP_KERNEL)); if (ret) { kfree(track); return ret; @@ -84,7 +84,7 @@ void intel_vgpu_unregister_page_track(struct intel_vgpu *vgpu, { struct intel_vgpu_page_track *track; - track = radix_tree_delete(&vgpu->page_track_tree, gfn); + track = xa_erase(&vgpu->page_track, gfn); if (track) { if (track->tracked) intel_gvt_hypervisor_disable_page_track(vgpu, gfn); diff --git a/drivers/gpu/drm/i915/gvt/vgpu.c b/drivers/gpu/drm/i915/gvt/vgpu.c index c628be05fbfe..6ec5d16f4e06 100644 --- a/drivers/gpu/drm/i915/gvt/vgpu.c +++ b/drivers/gpu/drm/i915/gvt/vgpu.c @@ -382,7 +382,7 @@ static struct intel_vgpu *__intel_gvt_create_vgpu(struct intel_gvt *gvt, mutex_init(&vgpu->vgpu_lock); mutex_init(&vgpu->dmabuf_lock); INIT_LIST_HEAD(&vgpu->dmabuf_obj_list_head); - INIT_RADIX_TREE(&vgpu->page_track_tree, GFP_KERNEL); + xa_init(&vgpu->page_track); idr_init(&vgpu->object_idr); intel_vgpu_init_cfg_space(vgpu, param->primary);