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 54484D59D95 for ; Fri, 12 Dec 2025 21:18:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 16A6810E968; Fri, 12 Dec 2025 21:18:13 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="kKFoiO++"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1C9E110E968 for ; Fri, 12 Dec 2025 21:18:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1765574291; x=1797110291; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=K7Wr5Ejy0w/e3VQx7UxZKcVxfXOedHep33NgbSMZ27o=; b=kKFoiO++WVVeyiNB6QhXP+Jp3L8EcAVtuHEVq2sxYrCPxKGQQZuxB3N2 i9/ZSYk+Ps+O3xvSp5thm5lCFPS2wB88/6C3JkzwIUFJ+bMrRt624eXJp VxTNxIMCSMEfB/NxkyjQwJSS6NTaw8gbyuVJs0buAS3Pm1fx4QjSsmBLp ekSi6Cr+biNwV+JLR7DpD/LSgoqLm79iBe/sSwyv4lI8zdzKOLIDNlEFw isDr3+gNgMpaRXWCnCSc1hTs5/y0L2PVjguarLWIo+7K1svBohG7EhBdV yXmGckEx545JODOqxFkeY5kHk1uM9G1hLlQy0Vob7EWCpfWUFpM4iX+zl Q==; X-CSE-ConnectionGUID: nb7vx+zRThqssyynLsGuAQ== X-CSE-MsgGUID: Gv9ADQ0DTk2u5yQBhbDF8A== X-IronPort-AV: E=McAfee;i="6800,10657,11640"; a="67541184" X-IronPort-AV: E=Sophos;i="6.21,144,1763452800"; d="scan'208";a="67541184" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Dec 2025 13:18:11 -0800 X-CSE-ConnectionGUID: Q8Pg2qTLTh27qhZBWq4D9w== X-CSE-MsgGUID: cROC4KnqRzev+QT02Q5KoA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,144,1763452800"; d="scan'208";a="197182891" Received: from unknown (HELO adixit-MOBL3.intel.com) ([10.125.212.54]) by orviesa007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Dec 2025 13:18:11 -0800 Date: Fri, 12 Dec 2025 13:18:10 -0800 Message-ID: <87zf7n4cx9.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Harish Chegondi Cc: , Umesh Nerlige Ramappa Subject: Re: [PATCH 1/1] drm/xe/eustall: Return EBADFD from read if EU stall registers get reset In-Reply-To: <6d78578c015b12e7ae243727ca7ed4b93551075d.1765174462.git.harish.chegondi@intel.com> References: <6d78578c015b12e7ae243727ca7ed4b93551075d.1765174462.git.harish.chegondi@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=US-ASCII X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" On Sun, 07 Dec 2025 22:16:11 -0800, Harish Chegondi wrote: > Hi Harish, > @@ -541,9 +541,24 @@ static ssize_t xe_eu_stall_stream_read_locked(struct xe_eu_stall_data_stream *st > size_t total_size = 0; > u16 group, instance; > unsigned int xecore; > + u32 base_reg_value; > int ret = 0; > > mutex_lock(&stream->xecore_buf_lock); > + /* If a GT or engine reset happens during EU stall data sampling, > + * all EU stall registers get reset to 0 and the cached values of > + * EU stall data buffers' read and write pointers are out of sync > + * with the register values. This can cause invalid data to be > + * returned from read(). To prevent this, check the value of a > + * EU stall base register. If it is zero, return -EBADFD. The > + * user is expected to close the fd and open a new fd. > + */ > + base_reg_value = xe_gt_mcr_unicast_read_any(gt, XEHPC_EUSTALL_BASE); > + if (unlikely(!base_reg_value)) { > + xe_gt_dbg(gt, "EU stall base register has been reset to 0\n"); > + mutex_unlock(&stream->xecore_buf_lock); > + return -EBADFD; > + } Since we are introducing an extra register read every read() call here, does it make sense to first check if there's a real userland need for this? And actually have a UMD PR which will consume this -EBADFD return value, before we merge this? Thanks. -- Ashutosh