Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp285991lqt; Thu, 6 Jun 2024 03:43:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUps6i5XBDHv0sLbjKvHR57CO706Yma4c13cO0D6Vv690mDc4b42HjgrJaA+2s3/xQNgQUv8XeodreK9b2OHOEeLSEpWBS5UkwReaE78Q== X-Google-Smtp-Source: AGHT+IESzM74JJliVE1LtLJsVYliJHLlrCZItub8/2Bc3Zk2oMgtUMvV3isHQQOqRgX3K+OXM2iY X-Received: by 2002:a17:906:33d7:b0:a67:7649:3c3b with SMTP id a640c23a62f3a-a699f6804ecmr300554966b.5.1717670602187; Thu, 06 Jun 2024 03:43:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717670602; cv=pass; d=google.com; s=arc-20160816; b=o/a9pZni4MY7cJUecBfwrZWnAJVjBpd3Nszv1Elp5+NFfhtY20uxtUwglNP+/AqEbX VP5KdCPTyfKRju/dY8t01Uq83LGwAtYXRS8ASJw8pRh7tz2eVBKX3wx7fcOQKxzB28cx VOgSSy6jPMaowpbli+b4Km/yXrLw7sJ0KVC5K3cTyPYKolXK6Q8hRmamnFgkUYJMlMFt mlU/MDp1U32KkdJGHCiRDYBecfyPvoy5yfakHqPd/IO7OIZQIPMwFDh2N1hF2fBkqlto h1zcIHLABTt9JJZhirQnCqfRFaCbgnJHymvkknFpO6OE+QjfXGdmt3y7rMmmp1aoJ0Jh NRzw== 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=85KcTGnWRG9wAbMI3szrdZtYSc2ZQeteBPXt/x8qtn4=; fh=lL+xUWFBlS4/V6eKTSjBh1iPsh/TryeaEamEzSG25SU=; b=W7Lutp4P08H4eOU+DvrOVbaJZ+A4fDxqyXZZoJjmdh5NC0hxbI1iMsCVVZaUGVgrkn spX9UjcqnnpVDrZLASi+Ggl6cFNmOeE41yjp9IcWGQo+Cw8A1v5uKCQdhiW73BrjK2gy bS5pA9wRU9p0PDaDFR9kQyR40NKCZI0u3i76QVBToA6y0ZsD1Wfce8CCKeFrwyJcXXvW /Mqyb34Cg4tHSxpW+fAkQbKnU5yk3q1PjTfynhCT/NfRg4JBai1bUEDJn4fa502ul7hQ lluesvYUXckdVCZ1kElRPqtySTVfn+u+POcAq1N9xeHYLIjYUWIjim3S90SuYAu++lok pNWA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=krpwgOhL; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-204126-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204126-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a6c8072860bsi56401566b.828.2024.06.06.03.43.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 03:43:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-204126-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=krpwgOhL; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-204126-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-204126-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 am.mirrors.kernel.org (Postfix) with ESMTPS id D424D1F24311 for ; Thu, 6 Jun 2024 10:43:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 459E2195382; Thu, 6 Jun 2024 10:42:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="krpwgOhL" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 84E7A13AD25; Thu, 6 Jun 2024 10:42:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717670574; cv=none; b=Aew80mSO3Lw3+zT8V8Tr/BKGzDzd+aXtaE/j3AJzSGT29RxRe+Wp6UD6vAwYBGm6zgzPFHtM/IzBns9Gi/28gxDQaLJTER1PSWRSA8tAIf6rdNE/Ma/z2/eoGcSxPDcwEB5iTzb9EuBdX7+SXLWAMR/q6trKCD1JwgC2rxWjnPE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717670574; c=relaxed/simple; bh=gcyhBTjSNVb7wu268JcVK1apAHBGJ38qvCp2uwXmZ1s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=c+29GgC9XcWNag/5DIPudznSQmKKZAeMJtOcQt6x6LalCvOcizpKHFJwbuQTg/ZbAJQp61RHUegmauNffBI0Gsqr6Bu+bWYXceVFBUG2+3pibSCZj8YzC/F4DW41xBFdhGUzUZq2w6v0gVfvJsLrsVCqXDEYHy3jPsvw39eTxys= 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=krpwgOhL; arc=none smtp.client-ip=192.198.163.11 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=1717670572; x=1749206572; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gcyhBTjSNVb7wu268JcVK1apAHBGJ38qvCp2uwXmZ1s=; b=krpwgOhLBnipgo5Fnn0y3On4QczWGAiM4fJTUM26P0ut5d49w2q3xQTt cfnjpGjsAMWaaqQBMULY2FW1HtgOCT13ZTi50JO338mjMPRPYgO34k5lY aW7dLPRaZac/+kBPtT6aAf0ClgUMn8kxkpRm5AZivfzGM0uHA7KCDi2Sx DUwAA3ZMKDUMLj4xsfGKBnCjoWDQ4epDjFyi8Fqp2JBGLz7lJSfVPtXK4 7uKujRZ4kMPRWPcEOuq8MZJBq2HAFCQF43nznDBn7yTYybjVQ8CrTK6/s LijaXkN0ew0zvFmgoLniQ4sNpN0a//Y4Oi62y2T5/VvDP23kuuPt7RgJ6 g==; X-CSE-ConnectionGUID: HPmJ5SygRcq098tuSA5/Hg== X-CSE-MsgGUID: jUgR1S1ARtGQpDcTtzCKNQ== X-IronPort-AV: E=McAfee;i="6600,9927,11094"; a="24962861" X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="24962861" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2024 03:42:51 -0700 X-CSE-ConnectionGUID: E4XLhoBnRnGlO87Bzez5OQ== X-CSE-MsgGUID: DGZC0NvkQUyZvd7qqdLNxg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.08,219,1712646000"; d="scan'208";a="37989265" Received: from fdefranc-mobl3.ger.corp.intel.com (HELO fdefranc-mobl3.localnet) ([10.245.246.29]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2024 03:42:48 -0700 From: "Fabio M. De Francesco" To: Jonathan Cameron Cc: Davidlohr Bueso , Dave Jiang , Alison Schofield , Vishal Verma , Ira Weiny , Dan Williams , linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6] cxl/events: Use a common struct for DRAM and General Media events Date: Thu, 06 Jun 2024 12:42:44 +0200 Message-ID: <4881660.OV4Wx5bFTl@fdefranc-mobl3> In-Reply-To: <20240605123000.00001e8f@Huawei.com> References: <20240602191238.27712-1-fabio.m.de.francesco@linux.intel.com> <20240605123000.00001e8f@Huawei.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 Wednesday, June 5, 2024 1:30:00=E2=80=AFPM GMT+2 Jonathan Cameron wrote: > On Sun, 2 Jun 2024 21:12:25 +0200 > "Fabio M. De Francesco" wrote: >=20 > > cxl_event_common was an unfortunate naming choice and caused confusion= =20 with > > 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 com= mon > > 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 > > Reviewed-by: Alison Schofield > > Reviewed-by: Dan Williams > > Reviewed-by: Ira Weiny > > Signed-off-by: Fabio M. De Francesco > > --- > >=20 > > - Changes for v6 - > >=20 > > - Add "Reviewed-by" tags > Hi Fabio, Hi Jonathan, =20 > Adding tags doesn't need a new version. b4 or however Dave is picking the= se > up will gather them up from the v5 posting. I just read what you replied in the v5 thread and know that now it makes m= ore=20 sense. > My one nervousness about this is the impression it perhaps gives that the= =20 contents > of validity flags has the same meaning in both records. >=20 > Maybe a comment to that effect next to it's definition makes sense? Yes, sure.=20 I'll add it. > I think the alternative of not including that or the remaining elements in > your common structure would be worse. >=20 > Jonathan >=20 Thank you, =46abio >=20 > >=20 > > - Changes for v5 - > >=20 > > - Rebase on v6.10-rc1 > >=20 > > - Changes for v4 - > >=20 > > - Initialise cxl_test_dram and cxl_test_gen_media without=20 > > unnecessary extra de-references (Dan) > > - Add a comment for media_hdr in union cxl_event (Alison) > >=20 > > - Changes for v3 - > >=20 > > - Rework the layout of cxl_event_dram and cxl_event_gen_media to > > make a simpler change (Dan) > > - Remove a "Fixes" tag (Dan) > > - Don't use unnecessary struct_group[_tagged] (Jonathan, Ira) > > - Rewrite end extend the commit message > >=20 > > - Link to v4 - > >=20 > > https://lore.kernel.org/linux-cxl/20240521140750.26035-1-fabio.m.de.fra= ncesco@linux.intel.com/ > >=20 > > drivers/cxl/core/mbox.c | 2 +- > > drivers/cxl/core/trace.h | 32 ++++++++++----------- > > include/linux/cxl-event.h | 41 ++++++++++----------------- > > tools/testing/cxl/test/mem.c | 54 +++++++++++++++++++----------------- > > 4 files changed, 61 insertions(+), 68 deletions(-) >=20 >=20 >=20 > > diff --git a/include/linux/cxl-event.h b/include/linux/cxl-event.h > > index 60b25020281f..1119d0bbb091 100644 > > --- a/include/linux/cxl-event.h > > +++ b/include/linux/cxl-event.h > > @@ -21,6 +21,17 @@ struct cxl_event_record_hdr { > > u8 reserved[15]; > > } __packed; > > =20 > > +struct cxl_event_media_hdr { > > + struct cxl_event_record_hdr hdr; > > + __le64 phys_addr; > > + u8 descriptor; > > + u8 type; > > + u8 transaction_type; > > + u8 validity_flags[2]; >=20 > Perhaps a comment to say that validity_flags meaning after bit 2 > varies across the different records? >=20 > > + u8 channel; > > + u8 rank; > > +} __packed; > > + > > #define CXL_EVENT_RECORD_DATA_LENGTH 0x50 > > struct cxl_event_generic { > > struct cxl_event_record_hdr hdr; > > @@ -33,14 +44,7 @@ struct cxl_event_generic { > > */ > > #define CXL_EVENT_GEN_MED_COMP_ID_SIZE 0x10 > > struct cxl_event_gen_media { > > - struct cxl_event_record_hdr hdr; > > - __le64 phys_addr; > > - u8 descriptor; > > - u8 type; > > - u8 transaction_type; > > - u8 validity_flags[2]; > > - u8 channel; > > - u8 rank; > > + struct cxl_event_media_hdr media_hdr; > > u8 device[3]; > > u8 component_id[CXL_EVENT_GEN_MED_COMP_ID_SIZE]; > > u8 reserved[46]; > > @@ -52,14 +56,7 @@ struct cxl_event_gen_media { > > */ > > #define CXL_EVENT_DER_CORRECTION_MASK_SIZE 0x20 > > struct cxl_event_dram { > > - struct cxl_event_record_hdr hdr; > > - __le64 phys_addr; > > - u8 descriptor; > > - u8 type; > > - u8 transaction_type; > > - u8 validity_flags[2]; > > - u8 channel; > > - u8 rank; > > + struct cxl_event_media_hdr media_hdr; > > u8 nibble_mask[3]; > > u8 bank_group; > > u8 bank; > > @@ -95,21 +92,13 @@ struct cxl_event_mem_module { > > u8 reserved[0x3d]; > > } __packed; > > =20 > > -/* > > - * General Media or DRAM Event Common Fields > > - * - provides common access to phys_addr > > - */ > > -struct cxl_event_common { > > - struct cxl_event_record_hdr hdr; > > - __le64 phys_addr; > > -} __packed; > > - > > 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; > > + /* dram & gen_media event header */ > > + struct cxl_event_media_hdr media_hdr; > > } __packed; >=20 >=20 >=20 >=20 >=20