From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0516CC4338F for ; Wed, 4 Aug 2021 14:26:13 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CCB3F60E97 for ; Wed, 4 Aug 2021 14:26:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org CCB3F60E97 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9DF426EA9C; Wed, 4 Aug 2021 14:26:11 +0000 (UTC) Received: from mail-wr1-x42a.google.com (mail-wr1-x42a.google.com [IPv6:2a00:1450:4864:20::42a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8D6D76EA8A for ; Wed, 4 Aug 2021 14:25:40 +0000 (UTC) Received: by mail-wr1-x42a.google.com with SMTP id b11so2491076wrx.6 for ; Wed, 04 Aug 2021 07:25:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tf+mOzcQNKHHz6LJhS8LPXuBWTq0ViZJrfxmoddi+oY=; b=bnLvdu+PYARfSfh7ErwMLlrG3mqedWgi0snpQM/SHog8chW5Z+JRfsyQ7XAfFlTkRE gZ74DIPEpRPqtT8lb/aLI1Kyt6JSO9KnqC20mjdJX5c4NQVTIOeY0st/HG+1zGlV/DU2 UMQqb3wMyIgxuzuzMYyHNenpzC3EjnkXy/mDY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tf+mOzcQNKHHz6LJhS8LPXuBWTq0ViZJrfxmoddi+oY=; b=H1OpfdVz6UDo1TCvbGGhrrYLfhFDx+4Lt35ds3GW0Vct18t10YSosQnSw8ThcO3VVK bfjfiLLz4uw3aB3h/PYTfb4rAqMt4HBkVmCallboYSTMUKX+8gGBROfYcpVDctvBiX/d B1mq7kN974pkmhreLX+i+aKvv/GEiXIPRU3PSwLJhTmxEYGmIADM+Jh1Zz0+b7MtZlXh XD1pQpIupuhsymP7MPehi0IDyvCU2jbCSJYW9J4V55CoJpD4DIO9h+fDkQg49/LOCK/A ehiqf5078cSDTyeQr9h2tuOhR4pxiNBKvtePgudP0SGZmV2H+py73kZ4EcdxcA7DrvyD Bd4w== X-Gm-Message-State: AOAM531aFv8b/yLL1bT7yR0KwftihVWQWQCNqiRYOzVOTXPFizHi15/B 8xtQ+RarGc0dwfByHDAjiFHjkQ== X-Google-Smtp-Source: ABdhPJznaAR9bPeMCyNq1rztAYlZmYDPpn9wN4TXqRrAzfj/f9xMuRLpnAwRbpa5nr7ZivB71j7voA== X-Received: by 2002:adf:dcd1:: with SMTP id x17mr28685761wrm.59.1628087139168; Wed, 04 Aug 2021 07:25:39 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id b6sm3222682wrn.9.2021.08.04.07.25.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Aug 2021 07:25:38 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Cc: DRI Development , Daniel Vetter , Daniel Vetter , Jon Bloomfield , Chris Wilson , Maarten Lankhorst , Joonas Lahtinen , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Matthew Auld , Lionel Landwerlin , Dave Airlie , Jason Ekstrand Subject: [PATCH v2 7/9] drm/i915: use xa_lock/unlock for fpriv->vm_xa lookups Date: Wed, 4 Aug 2021 16:25:20 +0200 Message-Id: <20210804142522.4113021-8-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210804142522.4113021-1-daniel.vetter@ffwll.ch> References: <20210804142522.4113021-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" We don't need the absolute speed of rcu for this. And i915_address_space in general dont need rcu protection anywhere else, after we've made gem contexts and engines a lot more immutable. Note that this semantically reverts commit aabbe344dc3ca5f7d8263a02608ba6179e8a4499 Author: Chris Wilson Date: Fri Aug 30 19:03:25 2019 +0100 drm/i915: Use RCU for unlocked vm_idr lookup except we have the conversion from idr to xarray in between. Signed-off-by: Daniel Vetter Cc: Jon Bloomfield Cc: Chris Wilson Cc: Maarten Lankhorst Cc: Joonas Lahtinen Cc: Daniel Vetter Cc: "Thomas Hellström" Cc: Matthew Auld Cc: Lionel Landwerlin Cc: Dave Airlie Cc: Jason Ekstrand --- drivers/gpu/drm/i915/i915_drv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 1488d166d91c..df2d723c894a 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1880,11 +1880,11 @@ i915_gem_vm_lookup(struct drm_i915_file_private *file_priv, u32 id) { struct i915_address_space *vm; - rcu_read_lock(); + xa_lock(&file_priv->vm_xa); vm = xa_load(&file_priv->vm_xa, id); if (vm && !kref_get_unless_zero(&vm->ref)) vm = NULL; - rcu_read_unlock(); + xa_unlock(&file_priv->vm_xa); return vm; } -- 2.32.0 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05C8AC432BE for ; Wed, 4 Aug 2021 14:26:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C875460C41 for ; Wed, 4 Aug 2021 14:26:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org C875460C41 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 608766EA9A; Wed, 4 Aug 2021 14:26:09 +0000 (UTC) Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8F1F46EA92 for ; Wed, 4 Aug 2021 14:25:40 +0000 (UTC) Received: by mail-wr1-x42e.google.com with SMTP id d8so2485583wrm.4 for ; Wed, 04 Aug 2021 07:25:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tf+mOzcQNKHHz6LJhS8LPXuBWTq0ViZJrfxmoddi+oY=; b=bnLvdu+PYARfSfh7ErwMLlrG3mqedWgi0snpQM/SHog8chW5Z+JRfsyQ7XAfFlTkRE gZ74DIPEpRPqtT8lb/aLI1Kyt6JSO9KnqC20mjdJX5c4NQVTIOeY0st/HG+1zGlV/DU2 UMQqb3wMyIgxuzuzMYyHNenpzC3EjnkXy/mDY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tf+mOzcQNKHHz6LJhS8LPXuBWTq0ViZJrfxmoddi+oY=; b=hrYaIUPROmZA/Ceo46KxXsqDkUVgYvCEjBXd8NZypPcqS+prsPuOzYqbP9rJGqWE5n BU3vqvl/qUzOcQA5Erwrhncqx+cXevsMPA4/E4DJO8ojOLTm8hQRAiqaXpR4Md+D85JT gKeR8UToqhBWThWGXWa+yMRMzaJxErKwN79OTEPcKI/hWbSg0af25Fygfe1FrMmJErvK OAERy3rM7i/SjBnSdnma4fE5qPn1lHKN6Am9jDoiN6woPZfvAWQvf9RUEXWk8mKvAn++ 3Gn2z1ojoIe0TFHY+XLKp1PsBuMnC0uioMCDkioMHyC7H8JVtcqOmUa8l6RWbPOVAN3K 4LRw== X-Gm-Message-State: AOAM532wk56cWAckzv26ISIACPrDYd50ukENpldLDlpkSgjQ7PIbSDBl EdtO/ky/6/RqkF+fxMLrdj8vs6Uyihg0VA== X-Google-Smtp-Source: ABdhPJznaAR9bPeMCyNq1rztAYlZmYDPpn9wN4TXqRrAzfj/f9xMuRLpnAwRbpa5nr7ZivB71j7voA== X-Received: by 2002:adf:dcd1:: with SMTP id x17mr28685761wrm.59.1628087139168; Wed, 04 Aug 2021 07:25:39 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id b6sm3222682wrn.9.2021.08.04.07.25.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Aug 2021 07:25:38 -0700 (PDT) From: Daniel Vetter To: Intel Graphics Development Cc: DRI Development , Daniel Vetter , Daniel Vetter , Jon Bloomfield , Chris Wilson , Maarten Lankhorst , Joonas Lahtinen , =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Matthew Auld , Lionel Landwerlin , Dave Airlie , Jason Ekstrand Date: Wed, 4 Aug 2021 16:25:20 +0200 Message-Id: <20210804142522.4113021-8-daniel.vetter@ffwll.ch> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210804142522.4113021-1-daniel.vetter@ffwll.ch> References: <20210804142522.4113021-1-daniel.vetter@ffwll.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Intel-gfx] [PATCH v2 7/9] drm/i915: use xa_lock/unlock for fpriv->vm_xa lookups X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" We don't need the absolute speed of rcu for this. And i915_address_space in general dont need rcu protection anywhere else, after we've made gem contexts and engines a lot more immutable. Note that this semantically reverts commit aabbe344dc3ca5f7d8263a02608ba6179e8a4499 Author: Chris Wilson Date: Fri Aug 30 19:03:25 2019 +0100 drm/i915: Use RCU for unlocked vm_idr lookup except we have the conversion from idr to xarray in between. Signed-off-by: Daniel Vetter Cc: Jon Bloomfield Cc: Chris Wilson Cc: Maarten Lankhorst Cc: Joonas Lahtinen Cc: Daniel Vetter Cc: "Thomas Hellström" Cc: Matthew Auld Cc: Lionel Landwerlin Cc: Dave Airlie Cc: Jason Ekstrand --- drivers/gpu/drm/i915/i915_drv.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index 1488d166d91c..df2d723c894a 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h @@ -1880,11 +1880,11 @@ i915_gem_vm_lookup(struct drm_i915_file_private *file_priv, u32 id) { struct i915_address_space *vm; - rcu_read_lock(); + xa_lock(&file_priv->vm_xa); vm = xa_load(&file_priv->vm_xa, id); if (vm && !kref_get_unless_zero(&vm->ref)) vm = NULL; - rcu_read_unlock(); + xa_unlock(&file_priv->vm_xa); return vm; } -- 2.32.0