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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C00E6C001E0 for ; Wed, 2 Aug 2023 16:27:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230504AbjHBQ1o (ORCPT ); Wed, 2 Aug 2023 12:27:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229701AbjHBQ1m (ORCPT ); Wed, 2 Aug 2023 12:27:42 -0400 Received: from mgamail.intel.com (unknown [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F6861FFA; Wed, 2 Aug 2023 09:27:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690993661; x=1722529661; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=0tSFjpEs5UlhC+O+bw+rDjme00w81L/vG49zgOEoiJY=; b=Qzc16tjw4RFlxlw9Onar/1NfK1B5uyRnLYyPQlR6g7wmoSx1ciDgkcv+ kUWfur2qBRlPLauAQKvWJjWGKYiWepgmQtu5Atj2Qt0fSnGkDqlda/3Mi SPSXS9SFAvOeIksPlkZGM5OHnpn4Ug6bGVDmInDN9BZNAEwQwYRNF6Nt8 Ya9fyBHG+St3F/ZeMgoamioO6py7EaaBj8YHiuTRg/8W6ID8I6pILo04k rN9sJJKIBeKB4xHMkf34rGkaGATQmj8VAUW0jwxtMxGxq+3by/v/GClET bdFfID8Wjbh/C9hF74hCQb5XIOYuCPk91Mq6+PMZRGexHc/yH3yNz+Cwt g==; X-IronPort-AV: E=McAfee;i="6600,9927,10790"; a="456006618" X-IronPort-AV: E=Sophos;i="6.01,249,1684825200"; d="scan'208";a="456006618" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2023 09:26:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.01,202,1684825200"; d="scan'208";a="872564979" Received: from aschofie-mobl2.amr.corp.intel.com (HELO aschofie-mobl2) ([10.212.146.50]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Aug 2023 09:26:07 -0700 Date: Wed, 2 Aug 2023 09:26:03 -0700 From: Alison Schofield To: Ira Weiny Cc: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Vishal Verma , Dan Williams , linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] cxl/mbox: Use correct handle in events debug message Message-ID: References: <20230731-cxl-fix-clear-event-debug-print-v2-0-9bdd08d386e9@intel.com> <20230731-cxl-fix-clear-event-debug-print-v2-1-9bdd08d386e9@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230731-cxl-fix-clear-event-debug-print-v2-1-9bdd08d386e9@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 01, 2023 at 01:13:28PM -0700, Ira Weiny wrote: > The handle value used to report an event being cleared by dev_dbg() is > incorrect due to a post increment of the payload handle index. > > Delay the increment of the index until after the print. > > Fixes: 6ebe28f9ec72 ("cxl/mem: Read, trace, and clear events on driver load") > Signed-off-by: Ira Weiny Reviewed-by: Alison Schofield > > --- > Changes for v2 > [Dan] Go ahead and mark this for backporting > [Dan] Remove 'To/Cc' cruft from individual patches > [Dan/Alison] Split out the additional debugging > [Alison] New oneliner > --- > drivers/cxl/core/mbox.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c > index d6d067fbee97..a1c490f66bbf 100644 > --- a/drivers/cxl/core/mbox.c > +++ b/drivers/cxl/core/mbox.c > @@ -882,9 +882,10 @@ static int cxl_clear_event_record(struct cxl_memdev_state *mds, > */ > i = 0; > for (cnt = 0; cnt < total; cnt++) { > - payload->handles[i++] = get_pl->records[cnt].hdr.handle; > + payload->handles[i] = get_pl->records[cnt].hdr.handle; > dev_dbg(mds->cxlds.dev, "Event log '%d': Clearing %u\n", log, > le16_to_cpu(payload->handles[i])); > + i++; > > if (i == max_handles) { > payload->nr_recs = i; > > -- > 2.41.0 >