Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4951749rwb; Mon, 31 Jul 2023 15:25:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlGFyPXf4xMICR778UQKYZL+Er/J5L7fIWI157wJCyDUNwy0Lp68NdlStL0IUoaDgBe7csmx X-Received: by 2002:a05:6808:3086:b0:3a7:4a89:752c with SMTP id bl6-20020a056808308600b003a74a89752cmr163410oib.31.1690842317762; Mon, 31 Jul 2023 15:25:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690842317; cv=none; d=google.com; s=arc-20160816; b=fKRlloGYMQFHUM3BjFPm24G4xygyet/6GHQbbjTU7nVNuXOJRdvw8QyVDQCMIS1M/z 0eEsIHP4B8x9A+fMHR3b/c8Rttz17xga9vSaGJUngCrlwtlqo6wPccbB2ue6RxHhd/cc +ccxJOemLx3OCWhBN5KFAzirkNbwuvPMJXe71gKYRAB6WVYb0JvYCjP/kmbl0mqNLhD5 IZeohs/P5AmmGgW59wz+UHt7qWHta4s8rb3uJuztvyQ6Wdi3Z0uwmm4mIpD+0rbVlKCZ M9zIFdms/MzO5+I7oXzPIRmSk8APUJg0KhPfZ9Mn4aWVPa6j1F0wgiINlUE1vHgBFrGG a0Dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=SfzUjnxtvAypvs0SMgJAxO97LxNdh4GuGU6MjIbtHgg=; fh=lMbSn//sSPQLBre/4ZA7U+KkPQoOkEHKnJ18CqTVr8Y=; b=RqhJ8lQfx5S7S3dBlynFovzRYvmIDwerCwc6M/O0rQvQI0ABAndzfrDBb5TN5lzfex 8hzLxWZtkGSuG101XqQi9e7w2iPQWVoQ9ETjyZpR+sBArh4NQ7CFeAX17k2AWWCtgBUg RMwNlBS5FKFbbBtBWGyA5od1C8nKi+Wf5uh+un+/FPiT9yYKdYGSffqYCuoF+jIRYUiI u35KEAlI+QOSIWuHBoySblsw/Rqmmk1nnmW/a57i1Zaf3VEiDFg4+QdzYejSYCReK1+R AQuN7Uph4lfTLcsnj7OHx32TvqKwqviqrWbJnK4f4KSpGr70T4FRG1ie3GebAT3hzubC 874A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=L6cKbiUP; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t24-20020a63b258000000b005641dfc74casi5687137pgo.745.2023.07.31.15.25.04; Mon, 31 Jul 2023 15:25:17 -0700 (PDT) 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=L6cKbiUP; 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 S230345AbjGaUwg (ORCPT + 99 others); Mon, 31 Jul 2023 16:52:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230269AbjGaUwb (ORCPT ); Mon, 31 Jul 2023 16:52:31 -0400 Received: from mgamail.intel.com (unknown [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A75CA1996; Mon, 31 Jul 2023 13:52:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1690836750; x=1722372750; h=from:date:subject:mime-version:content-transfer-encoding: message-id:to:cc; bh=MMLrINQqlo5ERuabFfXtd8/9Tw71gDUXuerUekiwWns=; b=L6cKbiUPJa5/5Gc9ZasMJTyzLARIBIvQcNYpRtZ8GKkrC2HOnmgn47U5 rgF0WV1eISsGGAhi9/V4EmzWyEYug+O7ka+UDLvcFvz7cAhrgBwn6POcx ko7Uyi2a8ZDG8d0RduaieN2PMk74NRadQJ5WmeaUOkO3BCY7MeboLHkS4 6jYseJrGJUDulgr2iAEmPyDAqLAfN0PaDYBgHve2aVhbR9/Q4WraW8uPt SqnvHV1QVw9xX4WlHm3y0dj+VocrrAlXbNlxZoFl2tdA2OHE9Ls1I0+H+ blFRsCN5ypaN4WKKoTQLJJN7kwClNU85Ay7XleAwIHrWlFTKUTvIgGN5L A==; X-IronPort-AV: E=McAfee;i="6600,9927,10788"; a="359161162" X-IronPort-AV: E=Sophos;i="6.01,245,1684825200"; d="scan'208";a="359161162" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jul 2023 13:52:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10788"; a="842441541" X-IronPort-AV: E=Sophos;i="6.01,245,1684825200"; d="scan'208";a="842441541" Received: from iweiny-mobl.amr.corp.intel.com (HELO localhost) ([10.212.100.68]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Jul 2023 13:52:29 -0700 From: Ira Weiny Date: Mon, 31 Jul 2023 13:52:27 -0700 Subject: [PATCH] cxl/mbox: Fix debug message print MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230731-cxl-fix-clear-event-debug-print-v1-1-42c068f500d1@intel.com> X-B4-Tracking: v=1; b=H4sIAAofyGQC/x2N0QqDMBAEf0XuuQdRsdL+SunDJdnqgU3lYkUQ/ 72xbzsszOyUYYpM92onw6pZP6lAfakojJIGsMbC1LimdX1bc9gmfunGYYIYY0VaOMJ/B55Ny25 910dxuHXXQMXiJYO9SQrj6XlLXmDnMRuK559+PI/jB5s+O2yKAAAA To: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , Dan Williams Cc: Jonathan Cameron , linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, Ira Weiny X-Mailer: b4 0.13-dev-c6835 X-Developer-Signature: v=1; a=ed25519-sha256; t=1690836749; l=2332; i=ira.weiny@intel.com; s=20221211; h=from:subject:message-id; bh=MMLrINQqlo5ERuabFfXtd8/9Tw71gDUXuerUekiwWns=; b=NDJ8AYz1EeCWvAUu2l2ox6sAWAIJUwJeMOPRrqpv92zI33XtqFnHAuM5FC2jHGCMk3cctKFt/ zitomy7UZ0HAZnC2ofeB7jGrXZL4V+4R6mAim0aDVQaaerdii0kWuH0 X-Developer-Key: i=ira.weiny@intel.com; a=ed25519; pk=noldbkG+Wp1qXRrrkfY1QJpDf7QsOEthbOT7vm0PqsE= X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org 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. Also add the debugging for event processing which was useful in finding this bug. To: Davidlohr Bueso To: Jonathan Cameron To: Dave Jiang To: Alison Schofield To: Vishal Verma To: Dan Williams Cc: Jonathan Cameron Cc: linux-cxl@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Ira Weiny --- NOTE: This does fix a bug in the patch referenced below. However, I don't think that warrants back porting because this is only a debug print. Fixes: 6ebe28f9ec72 ("cxl/mem: Read, trace, and clear events on driver load") --- drivers/cxl/core/mbox.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c index d6d067fbee97..f052d5f174ee 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; @@ -946,9 +947,13 @@ static void cxl_mem_get_records_log(struct cxl_memdev_state *mds, if (!nr_rec) break; - for (i = 0; i < nr_rec; i++) + for (i = 0; i < nr_rec; i++) { + dev_dbg(dev, "Event log %d: processing handle %u\n", + type, + le16_to_cpu(payload->records[i].hdr.handle)); cxl_event_trace_record(cxlmd, type, &payload->records[i]); + } if (payload->flags & CXL_GET_EVENT_FLAG_OVERFLOW) trace_cxl_overflow(cxlmd, type, payload); --- base-commit: 5d0c230f1de8c7515b6567d9afba1f196fb4e2f4 change-id: 20230731-cxl-fix-clear-event-debug-print-3b57da0e956c Best regards, -- Ira Weiny