Re: [PATCH 3/3] hwrng: imx-rngc - use polling to wait for end of seeding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Alexander,

Alexander Stein (alexander.stein@xxxxxxxxxxxxxxx) wrote:

> Am Dienstag, 22. August 2023, 17:25:53 CEST schrieb Martin Kaiser:
> > Use polling to wait until the imx-rngc is properly seeded.

> What is the benefit of burning CPU cycles while waiting for hardware?

it seems to me that

readl_poll_timeout
   readx_poll_timeout
      usleep_range
         usleep_range_state
            schedule_hrtimeout_range

will not wait in the foreground and burn CPU cycles.

The comment for schedule_hrtimeout_range says

 * Make the current task sleep until the given expiry time has
 * elapsed.

> > We do this only in the init function when the imx-rngc becomes active.
> > Polling is ok at this time, there's nothing else we could do while
> > we're waiting.

> > We can now remove the code for the interrupt and the completion.

> Please split the change to polling and IRQ removal into two patches.

Good point. Will do this in v2.

> RNGC_STATUS_SEED_DONE, 1000, RNGC_TIMEOUT * 1000);
> So you want to poll for up to 3s?

According to the manual, "The initial seed takes approximately 2,000,000
clock cycles." With a 66.5MHz clock, this is approx 30ms. So that should
be

RNGC_STATUS_SEED_DONE, 20000, 100000);

The comment for readx_poll_timeout suggests <= 20ms for the poll
interval.

Best regards,
Martin



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux