On 11/02/2025 11:57, Orzel, Michal wrote:
On 11/02/2025 12:18, Grygorii Strashko wrote:
The dt_device_for_passthrough() is called many times during Xen
initialization and Dom0 creation. On every call it traverses struct
dt_device_node properties list and compares compares properties name with
double "compares"
"xen,passthrough" which is runtime overhead. This can be optimized by
Are you sure? Looking at the calls, it's almost only used at boot except for dt
overlay.
marking dt_device_node as passthrough while unflattening DT.
This patch introduced new struct dt_device_node property "is_passthrough"
which is filled if "xen,passthrough" property is present while unflattening
DT and dt_device_for_passthrough() just return it's value.
In the past we were skeptical about adding new fields to the dt_device_node
structure for use cases like this one. I would say this optimization is not
worth it. Also, why would you optimize dt_device_for_passthrough but not
e.g. dt_device_is_available.
So we are trading speed with memory usage. It looks like we may be using
a padding, although I didn't check whether the existing structure could
be packed...
You can check with other Arm maintainers.
Before forging an opinion, I'd like to see some numbers showing the
performance improvement. Also, is this impacting only boot?
Also, I agree with Michal, if this is a concern for
dt_device_device_for_passthrough(). Then it would be a concern for a few
others calls using dt_find_property(). Are you going to modify all of them?
Cheers,
--
Julien Grall