mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alejandro Lucero Palau <alucerop@amd.com>
To: Dan Williams <dan.j.williams@intel.com>,
	Ira Weiny <ira.weiny@intel.com>,
	Dave Jiang <dave.jiang@intel.com>,
	Davidlohr Bueso <dave@stgolabs.net>,
	Jonathan Cameron <jonathan.cameron@huawei.com>,
	Alison Schofield <alison.schofield@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>
Cc: linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC 2/2] cxl/memdev: Remove temporary variables from cxl_memdev_state
Date: Wed, 5 Feb 2025 09:01:01 +0000	[thread overview]
Message-ID: <445fa543-d83a-44a8-b88d-84be8d979c43@amd.com> (raw)
In-Reply-To: <67a2adbdde7c6_2d2c294b5@dwillia2-xfh.jf.intel.com.notmuch>

<snip>
>>> I was hoping this would get further away from new in/out arguments and
>>> look at centralizing all partition enumeration into one routine.
>> I don't understand?  get partition info is only required if the partition align
>> bytes is not 0.  IOW if the device allows for partitions to be changed.
>> cxl_mem_get_partition_info() is only called IFF that extra query is required.
>> So this does centralize byte information queries into one routine.  It leaves
>> creating partitions to the device driver which moves us toward these being
>> mailbox only calls...
> The crux of the concern for me is less about the role of
> cxl_mem_get_partition_info() and more about the introduction of a new 'struct
> cxl_mem_dev_info' in/out parameter which is similar in function to
> 'struct cxl_dpa_info'. If you can find a way to avoid another level of
> indirection or otherwise consolidate all these steps into a straight
> line routine that does "all the DPA enumeration" things.
>

All this discussion after Dan's patches makes me feel miserable.


I have already used those patches for the Type2 support, and I'm using a 
struct to be used by accel drivers without a mbox for setting up the 
current mds information, required for building up the DPA partitions 
used the new functions. In this case, a struct is needed for sure, 
because there are two alternatives which are more painful than using 
such a struct:

  - one alternative is to allow accel drivers to manipulate internal cxl 
structs what would require, to start with, to export them fully for 
accel drivers. Then those drivers doing non trivial work for something 
the current cxl core is already doing and, IMO, which could be reused 
hidden the complexity.


- Another option, if not such new struct is used, is to pass the 
required data one by one, and although it could be fine by now, I think 
it is not as clean and it does not take into account potential changes 
hardcoded by accel drivers which would require further arguments.


What I have now is quite similar to current pci driver, but using a new 
function for accel drivers (where that new struct is used) instead of 
cxl_dev_state_identify, although some accel drivers will just call that 
function if there exists an mbox. Then cxl_mem_dpa_fetch and 
cxl_dpa_setup will make all the work as they do for the pci driver.


The change is simple and the code now cleaner than the previous versions 
where the DPA mess was still there. So, I'm happy with the DPA mess 
being solved, but ...


... what you seem to suggest now, and I mean both, Ira and Dan, is to 
optimize this which will make life harder for an accel driver. Or 
further helper functions will be needed, or the accel driver will need 
to do a lot of the work now performed by the core. I guess it is not a 
surprise if I speak up against any of these two possibilities.


Maybe it is worth if you have a look at v10 that will be sent later 
today, early in the morning for you, where all this can hopefully be 
seen clearly.




      reply	other threads:[~2025-02-05  9:01 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-28 18:51 [PATCH RFC 0/2] cxl: Further clean up of memdev state Ira Weiny
2025-01-28 18:51 ` [PATCH RFC 1/2] cxl/memdev: Remove unused partition values Ira Weiny
2025-01-29  8:58   ` Alejandro Lucero Palau
2025-01-29 15:09   ` Davidlohr Bueso
2025-01-29 16:51   ` Dave Jiang
2025-01-30 13:44   ` Jonathan Cameron
2025-02-04 20:59   ` Dan Williams
2025-02-04 23:59   ` Fan Ni
2025-01-28 18:51 ` [PATCH RFC 2/2] cxl/memdev: Remove temporary variables from cxl_memdev_state Ira Weiny
2025-01-29  9:08   ` Alejandro Lucero Palau
2025-01-29 16:32     ` Ira Weiny
2025-01-29 18:17       ` Alejandro Lucero Palau
2025-01-29 21:16         ` Ira Weiny
2025-01-29 16:52   ` Dave Jiang
2025-01-30  0:15   ` Davidlohr Bueso
2025-01-30 13:52   ` Jonathan Cameron
2025-01-30 15:14     ` Ira Weiny
2025-02-04 21:39   ` Dan Williams
2025-02-04 23:37     ` Ira Weiny
2025-02-05  0:15       ` Dan Williams
2025-02-05  9:01         ` Alejandro Lucero Palau [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=445fa543-d83a-44a8-b88d-84be8d979c43@amd.com \
    --to=alucerop@amd.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=ira.weiny@intel.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vishal.l.verma@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome