Message ID | 20230112165609.1083270-6-tvrtko.ursulin@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4013576wrt; Thu, 12 Jan 2023 09:38:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXt1FdJx42ZEFktkPNbC1vLzVz/Iwl9ifr66MNlkcczLgZ54W+TiZazVkQmsxA3smEz19t5f X-Received: by 2002:a17:902:e3d4:b0:193:6520:73a4 with SMTP id r20-20020a170902e3d400b00193652073a4mr10236396ple.61.1673545133271; Thu, 12 Jan 2023 09:38:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673545133; cv=none; d=google.com; s=arc-20160816; b=RNZLYJD6bW48FVWqUyFhedrFUyfG6vLPo0xZnvkaX21av9O8Lq9HaPZoztXyGrxKJx vR0by6XyV1f+W0w6FWc687gKzDRuuf3K1RunsFB4PiYQTW0vlLCzcXyzKhl94CQDOqQ9 JxhkFuEtVEmgzI8TpTRQp/CO2mnL7ksoJ01pZx024shNDO5b5eklk06rCGiWFnaHpxw2 TzBdObyI8G3BMIP7JOuzPzQYT7EziNrouWXIF8/REnDGXcUw3bORL8KhJpsXwT9zQZlq N/WuhWYYAoGa8U4euxiJORWc7XE9Gytaa+jJdz5sJtuCa6YaRVzjS7baW3tGC61f4Bhb sQgA== 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 :dkim-signature; bh=xFj5W26GNKlyf39Ictg3IXx24tiwxrq1DiXrMrDs9EI=; b=XykBoES0a4W1IYxkWdsspLQD3ARNA+8DWfsx/VbGlyzB6/a/piBeUvqn1ivuIM0Myt s/kuJHr5FabVSVO+mrNVZAaG3hBISGJamgy5SCGjj7YrzJpfXgn/4r19kxCFeJBfT4RD lQR6hVZPNW1ZljmzQP1f8Qw9sG2A/EFtgSvTskcM9sbVQiQ1fQ1NmPgqIJNBfL+J90eP gtd8YDPVZxlbbnRwqwZ2S4D2/G9isPtLrIrTvNNmtDLHZD/72fzErQ2mjEExFq9ewGg/ LGtohobLc/5U0KHiwNbXhUIPB8d1hNLfDsAgvg6x4eBdTUjj46kZ5PDqyBYgOqFHqsqm HcWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OsJ7nj+R; 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 f6-20020a170902ce8600b00192682632f2si18767254plg.396.2023.01.12.09.38.34; Thu, 12 Jan 2023 09:38:53 -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=OsJ7nj+R; 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 S230496AbjALRhX (ORCPT <rfc822;zhuangel570@gmail.com> + 99 others); Thu, 12 Jan 2023 12:37:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231891AbjALRgZ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 12 Jan 2023 12:36:25 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C756C7826E; Thu, 12 Jan 2023 08:57:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673542679; x=1705078679; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gA5/njLr6I387+ufsBDRnAQjKtZ0ST5kVZFmIu51Hl0=; b=OsJ7nj+RG9O+8htK08tYbUjwRBCUde4UInFKJj9eHhZ3/IhKYGzacD6k fEm9/5SW13OlNcVtbSc0qqmoylBSRDCp0+rM5G0GreWqig3F1riso2cJm k8Lepfn9IzWLDi3Lftq28XJS6scZpdtApcjEYtz5g8H5KepFzQCvrhICc Zrej3Rq9Pr93HbrK/O5jeuNeM3XIEF58diEzdPdUIFWNdK4vcj2mX1rFS hHoGlXhZonPDwoBVGHv9WgWfsxTL7jkQXP3PwSH6n49ZwAoO/I0nH7260 6ftB3MZgmyCGhnUU19mn5q4PD4AVQqL+1pgZ6ToOUQDrDlgex34OH2Gbd A==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="325016435" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="325016435" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 08:56:46 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="651232719" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="651232719" Received: from jacton-mobl.ger.corp.intel.com (HELO localhost.localdomain) ([10.213.195.171]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 08:56:42 -0800 From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com> To: Intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org Cc: cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Tejun Heo <tj@kernel.org>, Johannes Weiner <hannes@cmpxchg.org>, Zefan Li <lizefan.x@bytedance.com>, Dave Airlie <airlied@redhat.com>, Daniel Vetter <daniel.vetter@ffwll.ch>, Rob Clark <robdclark@chromium.org>, =?utf-8?q?St=C3=A9phane_Marchesin?= <marcheu@chromium.org>, "T . J . Mercier" <tjmercier@google.com>, Kenny.Ho@amd.com, =?utf-8?q?Chris?= =?utf-8?q?tian_K=C3=B6nig?= <christian.koenig@amd.com>, Brian Welty <brian.welty@intel.com>, Tvrtko Ursulin <tvrtko.ursulin@intel.com> Subject: [RFC 05/12] drm/cgroup: Allow safe external access to file_priv Date: Thu, 12 Jan 2023 16:56:02 +0000 Message-Id: <20230112165609.1083270-6-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230112165609.1083270-1-tvrtko.ursulin@linux.intel.com> References: <20230112165609.1083270-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HK_RANDOM_ENVFROM,HK_RANDOM_FROM, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754839261925916011?= X-GMAIL-MSGID: =?utf-8?q?1754839261925916011?= |
Series |
DRM scheduling cgroup controller
|
|
Commit Message
Tvrtko Ursulin
Jan. 12, 2023, 4:56 p.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com> Entry points from the cgroup subsystem into the drm cgroup controller will need to walk the file_priv structures associated with registered clients and since those are not RCU protected lets add a hack for now to make this safe. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com> --- drivers/gpu/drm/drm_cgroup.c | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/drivers/gpu/drm/drm_cgroup.c b/drivers/gpu/drm/drm_cgroup.c index d91512a560ff..46b012d2be42 100644 --- a/drivers/gpu/drm/drm_cgroup.c +++ b/drivers/gpu/drm/drm_cgroup.c @@ -18,6 +18,13 @@ __del_clients(struct drm_pid_clients *clients, if (atomic_dec_and_test(&clients->num)) { xa_erase(&drm_pid_clients, pid); kfree_rcu(clients, rcu); + + /* + * FIXME: file_priv is not RCU protected so we add this hack + * to avoid any races with code which walks clients->file_list + * and accesses file_priv. + */ + synchronize_rcu(); } }