Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2618126lqo; Mon, 20 May 2024 10:55:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVxn57jMQ7+716vW9P6vj1GWSxdupdpZnD5DGAZIg19H8FjeZkwrAOd/LjGgGkE9B7ojMwuChlvW5J+tddgXq7w8do3iP0XIuK6AKUQVg== X-Google-Smtp-Source: AGHT+IEaTPjkaw+OJFRv9cPKFpi+KkZeoZk9pZN3tpq5aT0RBp+jNmJCdArInmw17QCTkJcB9kpm X-Received: by 2002:a05:620a:4607:b0:792:95f1:22ef with SMTP id af79cd13be357-792c75f0fa8mr3922141185a.49.1716227734536; Mon, 20 May 2024 10:55:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716227734; cv=pass; d=google.com; s=arc-20160816; b=Ku7fPl0GBaPAHBYvNVgdS+LuYyQdD2ixuoa4DqkX5KmgwJI03mtDrs177GrMBxmg3T oJfZr98HANJ04zThPidcxAobb6iFrc7foRHwkVR/NmRyQMTQNXGXmqwDabRtcrrOuK/3 y9VaUPX905EEZsZ049C6UpxJyWqJv5OGA7osc6S3+x1us7840z2pmDB9FiChsrL+o7bq M6ayhh15/NUjtmXFM1q6OnnviQMsLyYgwP5CkLAQjBVRLmhZ5y0coSF9wH4dYsNjUHTP vFXKukENtWcOIP1KpT7P2zeX49Uh6ilqCsHJNFUU/BIHnessWLUg5Y8nFYR6RjZUcF12 1HSg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=jhjtRCJZ5UBC6YdR4Ag8YGsyCymw3x2EhzyxYneZFfM=; fh=BZ6DwHmFr+v3WoFfrhA7u+6CW6Ft92gyt5agY3uZ/LI=; b=RojA/HMYZqV9a2Fbloz15pxNGC7qGw0x7/GS6CX4B33vIy6K/4CyJnziZJ+h7KCXs+ IBNdP8PAl1qt1hOBFgddekHWbVOr2tKa2pbSMW3N9c35Bq9J9ez07prWe0Q2eOoAzN6A 6gihN6pGiWPDRJcFmnHZKx0nf5F1Y+vHvQorTYLKz6sFoF8zA3K7by7QW1hMZc0NliTW I05nBbY2ROut55ekI5X3FzcmCdo1QTDDZc/TwbynHpcIFQ9blZXbCjqrOc4aNkdZq4Mn 2Ona+2JhiYNMs4dzB68oJuRok1J/1PMNmux5eWCniaFANcTCfmA3AaDo4OrORpuKFkIt UE6Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Rr02vDPC; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-184027-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184027-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-792bf38d031si2754071085a.698.2024.05.20.10.55.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 May 2024 10:55:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-184027-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Rr02vDPC; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-184027-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184027-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 4088A1C21869 for ; Mon, 20 May 2024 17:55:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AF64B137C3F; Mon, 20 May 2024 17:55:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Rr02vDPC" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3178913398E; Mon, 20 May 2024 17:55:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716227726; cv=none; b=RgfhEVfn4lBdOJU3EaLKZ/w7tiEe/8vEJpsxaIGZe3tS6+cQFmQQjy1O3C9+LswWsNR3SFhT73UKyacOzWX9I5+gCiPhVqoe2+gFzFYVqo87HpHIJv5r0t51Pw4/hvAE95b9TTYOeXpZTkhGPtzhmJ6EX6+ClvAlxzg6LlMdaJY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716227726; c=relaxed/simple; bh=dzIx0OC26E5dApNJ0s1+EMiQ0pn0lx5sKEcZY24+oKQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=b2BJ3tJ5Q1ar+TJydTeTqwQkqOIvFiSlRQXndXbOcLCbd1aNoKLcLkD2Py8E1AoP9Sf0IJeQ02foa/UHOdVoZrRMNRBfdbdKcKGhmFbCvCl6cfoLhtCvz238rXHHgaZD4/lg40DjN7JqXcf4a7e9q21dd3QEgXWYpbwhVTdqgYc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Rr02vDPC; arc=none smtp.client-ip=192.198.163.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1716227725; x=1747763725; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dzIx0OC26E5dApNJ0s1+EMiQ0pn0lx5sKEcZY24+oKQ=; b=Rr02vDPCHwjl/qjEEWe/wJWnkeDsB+LSYkN2eDOdIb7Ov4ikw7/MG3c9 pXBFMg7GW1Jwh5Mg4zDkDSElyJ6xDVEFk4VD0wVoOolEAHO1kE5VFrmrz ckRRyioNV+f9FBTe3As3yOR7uQWUCfmxmzkP51GurRjjYcQVdqUtU9v+t Yfh9ggn6EjML/To5aU/cOTGU1JBmfW0WqM7yb1E4fuBOvEd0BWSb9H3LZ s2xkEawCsNNz39IbpBAZPmtmgk0mG9H3gBg7kj+W9Iq1zC3WzQj5Hb9gX yLKjqaUZHw4gNa/jpZp2kGn5j24T9MSaCaB9nampkZSnANpkjelIT5WPl w==; X-CSE-ConnectionGUID: 6lJuRs9DQdmh7gpLHwN0MA== X-CSE-MsgGUID: kplNK1YNSs+S3+3f1hLQpg== X-IronPort-AV: E=McAfee;i="6600,9927,11078"; a="12248092" X-IronPort-AV: E=Sophos;i="6.08,175,1712646000"; d="scan'208";a="12248092" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2024 10:55:23 -0700 X-CSE-ConnectionGUID: p7ex7YgvS66k9CZqocFvxA== X-CSE-MsgGUID: VrcCacuEQV63JrUoa4EFyw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,175,1712646000"; d="scan'208";a="32605467" Received: from fdefranc-mobl3.ger.corp.intel.com (HELO fdefranc-mobl3.localnet) ([10.245.246.122]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 May 2024 10:55:21 -0700 From: "Fabio M. De Francesco" To: Ira Weiny , Dan Williams Cc: Davidlohr Bueso , Jonathan Cameron , Dave Jiang , Alison Schofield , Vishal Verma , linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, "Fabio M. De Francesco" Subject: Re: [PATCH v3] cxl/events: Use a common struct for DRAM and General Media events Date: Mon, 20 May 2024 19:55:17 +0200 Message-ID: <4446774.UPlyArG6xL@fdefranc-mobl3> In-Reply-To: <20240518113317.3683718-1-fabio.m.de.francesco@linux.intel.com> References: <20240518113317.3683718-1-fabio.m.de.francesco@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On Saturday, May 18, 2024 1:26:21=E2=80=AFPM GMT+2 Fabio M. De Francesco wr= ote: > cxl_event_common was an unfortunate naming choice and caused confusion wi= th > the existing Common Event Record. Furthermore, its fields didn't map all > the common information between DRAM and General Media Events. >=20 > Remove cxl_event_common and introduce cxl_event_media_hdr to record common > information between DRAM and General Media events. >=20 > cxl_event_media_hdr, which is embedded in both cxl_event_gen_media and > cxl_event_dram, leverages the commonalities between the two events to > simplify their respective handling. >=20 > Suggested-by: Dan Williams > Signed-off-by: Fabio M. De Francesco > --- >=20 > [...] > - > union cxl_event { > struct cxl_event_generic generic; > struct cxl_event_gen_media gen_media; > struct cxl_event_dram dram; > struct cxl_event_mem_module mem_module; > - struct cxl_event_common common; > + struct cxl_event_media_hdr media_hdr; > } __packed; Today I was thinking about a comment from Ira. He didn't like the addition = of=20 an event that is not in the specs.[0] (Notice that the other issues have be= en=20 already addressed).=20 I dislike the addition of an artificial event for the very same reasons Ira= =20 expressed. This additional event could be easily removed by something simple like the= =20 following diff. =46abio [0] https://lore.kernel.org/linux-cxl/66467b8b47170_8c79294b3@iweiny-mobl.n= otmuch/ diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c index a08f050cc1ca..05de8836adea 100644 =2D-- a/drivers/cxl/core/mbox.c +++ b/drivers/cxl/core/mbox.c @@ -875,7 +875,13 @@ void cxl_event_trace_record(const struct cxl_memdev=20 *cxlmd, guard(rwsem_read)(&cxl_region_rwsem); guard(rwsem_read)(&cxl_dpa_rwsem); =20 =2D dpa =3D le64_to_cpu(evt->media_hdr.phys_addr) & CXL_DPA_M= ASK; + if (event_type =3D=3D CXL_CPER_EVENT_GEN_MEDIA) + dpa =3D le64_to_cpu(evt->gen_media.media_hdr.phys_a= ddr) + & CXL_DPA_MASK; + else if (event_type =3D=3D CXL_CPER_EVENT_GEN_MEDIA) + dpa =3D le64_to_cpu(evt->dram.media_hdr.phys_addr) + & CXL_DPA_MASK; + cxlr =3D cxl_dpa_to_region(cxlmd, dpa); if (cxlr) hpa =3D cxl_trace_hpa(cxlr, cxlmd, dpa); diff --git a/include/linux/cxl-event.h b/include/linux/cxl-event.h index 6562663a036d..f0a5be131e6a 100644 =2D-- a/include/linux/cxl-event.h +++ b/include/linux/cxl-event.h @@ -97,7 +97,6 @@ union cxl_event { struct cxl_event_gen_media gen_media; struct cxl_event_dram dram; struct cxl_event_mem_module mem_module; =2D struct cxl_event_media_hdr media_hdr; } __packed; =20 /*