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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 3122FF55104 for ; Sat, 7 Mar 2026 21:22:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CCE3910E11B; Sat, 7 Mar 2026 21:22:20 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="dFMcu5pA"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by gabe.freedesktop.org (Postfix) with ESMTPS id D4F6510E11B for ; Sat, 7 Mar 2026 21:22:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1772918540; x=1804454540; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version:content-transfer-encoding; bh=uZJnaWvE1NX3cZMARoQMSRxmcMeXUg1uryo0aDvWuI0=; b=dFMcu5pA2UV53rEJqWQLNPY45TlK/Y/8xxBTFttUy7v05jRqcSC0lmSv aD4Cj6EmSYFPzSXUgO6/xobjMyCwNqJhi8WUyuxlAovkiefD5rb3+O+Yj xxh99dHTuNo/bz9wnkFjJj6I8S8GNOoLKR+HFlwgbn990L9a6mrasqMG4 eIJ92ukjDqzsG1f8GvQ4PJBbR6eoph5Jc53tELtmvU5yCb5zXKKvs8mNK JYFyhz12wW326gRGtlFHQ5hZUiUp/hbkNHRPm2RN/oGbhOI6v2PFRo56q uvuy4Anhpfmm/pWirTNHNg9eIS6D1qnli97HB6mAx607qxWgA7CjnzgSR w==; X-CSE-ConnectionGUID: qLvyxqTgQt6ciJ8E2aSEag== X-CSE-MsgGUID: 8Cl27nSySvGi2jRjm2mm9g== X-IronPort-AV: E=McAfee;i="6800,10657,11722"; a="76597461" X-IronPort-AV: E=Sophos;i="6.23,107,1770624000"; d="scan'208";a="76597461" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2026 13:22:19 -0800 X-CSE-ConnectionGUID: K3I6MPjWTu6FIl1AcreHLQ== X-CSE-MsgGUID: IAg6S6lmRy2yFm/1uM3vsA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,107,1770624000"; d="scan'208";a="242363637" Received: from rmigue1x-mobl.amr.corp.intel.com (HELO adixit-MOBL3.intel.com) ([10.125.38.160]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Mar 2026 13:22:19 -0800 Date: Sat, 07 Mar 2026 13:22:18 -0800 Message-ID: <87ldg3s5bp.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Cc: , , , Subject: Re: [PATCH v4 i-g-t] lib/intel_pat: Cache PAT config for unprivileged processes In-Reply-To: <87qzpyroy5.wl-ashutosh.dixit@intel.com> References: <20260305185431.6515-1-himanshu.girotra@intel.com> <87qzpyroy5.wl-ashutosh.dixit@intel.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?ISO-8859-4?Q?Goj=F2?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.2 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: igt-dev@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development mailing list for IGT GPU Tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" On Thu, 05 Mar 2026 12:39:14 -0800, Dixit, Ashutosh wrote: > > On Thu, 05 Mar 2026 10:54:31 -0800, wrote: > > > > From: Himanshu Girotra > > > > Commit 4e59b8e7779b ("lib/intel_pat: use kernel debugfs as > > authoritative PAT source for Xe") changed the Xe PAT lookup to > > read from debugfs, which requires root access. Some xe_oa subtests > > fork a child process that drops root privileges before performing > > GPU operations that internally need the PAT write-back index. > > After dropping root, the debugfs read fails. > > > > Fix this by caching the PAT configuration in struct xe_device at > > xe_device_get() time. Since xe_device_get() is called while still > > root, the cache is available to forked children even after > > igt_drop_root(). Tests that open a new fd after forking must call > > xe_device_get() explicitly before dropping root to populate the > > cache for that fd. > > > > v2: Cache PAT in struct xe_device instead of a global static; > > drop the intel_pat_precache() helper =E2=80=94 xe_device_get() alre= ady > > populates the cache, so call it directly in xe_oa before > > igt_drop_root() (Ashutosh Dixit) > > > > v3: Use pat_cache pointer, NULL indicates unpopulated cache; > > remove redundant xe_oa.c change (Ashutosh Dixit) > > > > Add FIXME for multi-GPU (Zbigniew Kempczy=C5=84ski) > > > > v4: nit fixes and use forward declaration in xe_query.h (Ashutosh Dixit) > > Reviewed-by: Ashutosh Dixit Thanks for the quick turnaround on the fix. The patch is now merged!