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 42F9BC021B2 for ; Tue, 25 Feb 2025 23:34:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DB30510E1AC; Tue, 25 Feb 2025 23:34:54 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="kthNbjYe"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4BE9310E1AC for ; Tue, 25 Feb 2025 23:34:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1740526493; x=1772062493; h=date:message-id:from:to:cc:subject:in-reply-to: references:mime-version; bh=7eQQOLFPSJ/2M0t0gs+D+JWlStpVIRsuRDR3cakqXxM=; b=kthNbjYe2IYiaah9c22+7ayiaMvbn4g9VPxOBfGwdNBeB8Wl43/YyF5g fyQWzaRRM0gfbc4erQavZg2vkr5BEejBUJSoYm1vm8r3m/UQ4VlnKxJ7P IGG1BnaQ8MqNOyqYeaFI3VyHrQFEKLi+rZtBnhFJ4KamLeFCR3SzB3CJm uCSQK+WfE/SPusNk5wsSFlOjGP6qPBkBOTRtiLgZ3m4SA0Qpog5qZ1SW7 EzAGH1t6TbltlaVnYerEMKNIqXMMBb8Jjgb+IuHdyCXjrHHy96Eda0WmU DyGm8jzTBzpFJlItwIFjxgWJ1aOcmHzvzWzJMk+m8+fGOyBuylSTgnxJp g==; X-CSE-ConnectionGUID: pWRgcOaARF2V+x6m3JjcHw== X-CSE-MsgGUID: +1I4hHpLQ6G7LGXqiIlIQQ== X-IronPort-AV: E=McAfee;i="6700,10204,11356"; a="52754786" X-IronPort-AV: E=Sophos;i="6.13,314,1732608000"; d="scan'208";a="52754786" Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2025 15:34:53 -0800 X-CSE-ConnectionGUID: z5f/BbCSSPuujxtF8DXjAQ== X-CSE-MsgGUID: Ny0M4QOhRL+OL2j3tGcngg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.13,314,1732608000"; d="scan'208";a="117022778" Received: from orsosgc001.jf.intel.com (HELO orsosgc001.intel.com) ([10.165.21.142]) by fmviesa010-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Feb 2025 15:34:52 -0800 Date: Tue, 25 Feb 2025 15:34:52 -0800 Message-ID: <85a5a9k38j.wl-ashutosh.dixit@intel.com> From: "Dixit, Ashutosh" To: Harish Chegondi Cc: Subject: Re: [PATCH v11 5/8] drm/xe/eustall: Add support to handle dropped EU stall data In-Reply-To: <33eb4ea0ee3097eef392b837205c21a78e4c64ea.1740474556.git.harish.chegondi@intel.com> References: <33eb4ea0ee3097eef392b837205c21a78e4c64ea.1740474556.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/28.2 (x86_64-redhat-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 Tue, 25 Feb 2025 01:20:22 -0800, Harish Chegondi wrote: > > static int xe_eu_stall_data_buf_read(struct xe_eu_stall_data_stream *stream, > char __user *buf, size_t count, > size_t *total_data_size, struct xe_gt *gt, > @@ -362,6 +378,9 @@ static int xe_eu_stall_data_buf_read(struct xe_eu_stall_data_stream *stream, > buf_size = stream->per_xecore_buf_size; > > read_data_size = buf_data_size(buf_size, read_ptr, write_ptr); > + if (read_data_size == 0) > + goto exit_drop; > + This is not needed. Just add the 'goto exit_drop;' to the 'if (read_data_size == 0)' a couple of lines below. > /* Read only the data that the user space buffer can accommodate */ > read_data_size = min_t(size_t, count - *total_data_size, read_data_size); > if (read_data_size == 0) Add 'goto exit_drop;' here instead of 'return 0;'. Note that here count must be > *total_data_size, because in xe_eu_stall_stream_read_locked, we break out and don't call xe_eu_stall_data_buf_read() if count == total_size. Therefore, for read_data_size to be 0 here, read_data_size on the right hand side must already be zero. So the two 'goto exit_drop;''s are equivalent. After moving the 'goto exit_drop;' this patch is also: Reviewed-by: Ashutosh Dixit