On 06.05.2025 09:22, Penny, Zheng wrote:
>> -----Original Message-----
>> From: Jan Beulich <jbeul...@suse.com>
>> Sent: Monday, April 28, 2025 11:32 PM
>>
>> On 14.04.2025 09:40, Penny Zheng wrote:
>>> --- a/xen/drivers/cpufreq/cpufreq.c
>>> +++ b/xen/drivers/cpufreq/cpufreq.c
>>> +    {
>>> +    case XEN_PX_INIT:
>>> +        if ( shared_type )
>>> +            *shared_type = processor_pminfo[cpu]->perf.shared_type;
>>> +        if ( domain_info )
>>> +            *domain_info = processor_pminfo[cpu]->perf.domain_info;
>>
>> Does this need to be a structure copy? Can't you hand back just a pointer, 
>> with the
>> function parameter being const struct xen_psd_package **?
>>
> 
> I've considered handing backing a pointer, then maybe we need to allocate 
> space for
> "struct xen_psd_package **domain_info = xvzalloc(struct xen_psd_package *);", 
> and XVFREE(xxx)
> it in each exit, especially cpufreq_add_cpu() has a lot exits, which could be 
> a few code churn.
> So I chose the struct copy to have the smallest change.

I fear I don't see why such allocations (of space holding a single pointer)
would be necessary. Afaict all you need is a local variable of the specific
(pointer) type, the address of which you pass into here.

Jan

Reply via email to