Subject: Re: [BUG] Regression with commit: ptp: Add .getmaxphase callback to ptp_clock_info

From: Rahul Rameshbabu <[email-masked]>
Date: Thu, 19 Sep 2024 21:05:16 -0700

On Thu, 12 Sep, 2024 20:55:22 -0700 Richard Cochran <[email-masked]> wrote:
> On Thu, Sep 12, 2024 at 04:51:51PM +0200, Christophe ROULLIER wrote:
>> Hi Richard,
>> 
>> 
>> I put in attachment result of pahole.
>> 
>> It is :
>> 
>> struct ptp_clock_caps {
>>     int                        max_adj;              /*     0 4 */
>>     int                        n_alarm;              /*     4 4 */
>>     int                        n_ext_ts;             /*     8 4 */
>>     int                        n_per_out;            /*    12 4 */
>>     int                        pps;                  /*    16 4 */
>>     int                        n_pins;               /*    20 4 */
>>     int                        cross_timestamping;   /*    24 4 */
>>     int                        adjust_phase;         /*    28 4 */
>>     int                        max_phase_adj;        /*    32 4 */
>>     int                        rsv[11];              /*    36 44 */
>> 
>>     /* size: 80, cachelines: 2, members: 10 */
>>     /* last cacheline: 16 bytes */
>> };
>
> Total size is 80 bytes.
>
> As expected.
>
> So I can't explain the error that you are seeing.

Could you share what kind of STM32 development board you are using (like
the model), the kernel config, and toolchain you are using to build the
kernel? I would be interested in trying to reproduce. Also could you run
pahole on the ptp kernel module, "/lib/modules/$(uname -r)/kernel/drivers/ptp/ptp.ko",
and check the size of struct ptp_clock_caps there? If it is compressed,
you will need to uncompress the kernel object.

I am having a hard time believing commit
c3b60ab7a4dff6e6e608e685b70ddc3d6b2aca81 is the fundamental culprit, but
more likely it exposes some other issue seen uniquely on armhf. My
theory is if you have another commit that changes struct ptp_clock_caps
and adds an additional used field in place of a rsv element, you would
experience the same issue.

I do not work on PTP professionally anymore, but I am interested in
looking into this.

-- 
Thanks,

Rahul Rameshbabu