Received: by 2002:a05:7412:1492:b0:e2:908c:2ebd with SMTP id s18csp524640rdh; Wed, 23 Aug 2023 07:17:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFD7IYf1mZFKIj+OScoO658ErJ95nK5IoRumX2dQ9V0Amlp68P1Uj8qE2PVgDa+tzoEpv/r X-Received: by 2002:a17:903:32ca:b0:1af:e302:123 with SMTP id i10-20020a17090332ca00b001afe3020123mr20815838plr.3.1692800238712; Wed, 23 Aug 2023 07:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692800238; cv=none; d=google.com; s=arc-20160816; b=scSq5gQfFdHkN2hgjuhjg7jkqyDSU+i/vepmALi+dCnLRs4tKk9/1mnk9vhbX36ZK6 xN1EXmC1jsCrXemKWmvX/8S6l6c6rjBXJIJU7QVZrun0usPcpdlMNm+3taQehoYniy0+ lVl0HCvpM6yEdeDsu0N774gK1BZM0lR9ZVqQ9BMMRkCdv+8guh8lfoJ6STLY7zYbRhcB a2y+XXgzjR8n3u5ew1DKcgdmKDPRKy8HYkYOoolH4tuTnEFBqgER5TzPQQvy8mMyKQed YrcCYmiXHy9pKXwjVhS/KKmLgY+NPTg4DknkE29Ss+i+bObApfz0LXjQVUJlBn3ceCmO WKRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=/hSQVrSJAZW/ugOMj7aUCenDh1ObRhcgixJkU+hnRw8=; fh=Z9+sVswiyhz+zC1duoCMQiqmNPIgNJgY+W6oklTqWNM=; b=Ju0UNzQsyrKN0y40QiOn0O1sK8CYwmKv6IA8+wvNzEDZA3IVXKcdJMYC4Ax3qZvo1A n605VT4J4z+juwtTfix93GK564XIujstacoedQ3cod/8mHMWFpetp7g5i53dB/LAe/aI 6jX7tjvGYN4E5A6I/Wj2NlNOpI6PethxC6g4TcTg9VpX/c8jcP8MTOJcpQzOuFWcWcE9 kxUIHCgu9gr2Pgry7+pccr4QqRPX2rkIset9Z7lytYQsoFF/u5XdSUwJ8CbiawuwLlnM lmIW1EXwlbfZyK7Wk+Q6qjTsx7Pmn+94aRs7SSwqbMdoRvtuOod143HrV806kcZvV1i7 VnJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kw4-20020a170902f90400b001bb974b26c4si3552297plb.238.2023.08.23.07.17.03; Wed, 23 Aug 2023 07:17:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234061AbjHWLQh (ORCPT + 99 others); Wed, 23 Aug 2023 07:16:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231165AbjHWLQg (ORCPT ); Wed, 23 Aug 2023 07:16:36 -0400 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 711BD184; Wed, 23 Aug 2023 04:16:10 -0700 (PDT) Received: from martin by viti.kaiser.cx with local (Exim 4.89) (envelope-from ) id 1qYlqH-0006gR-QF; Wed, 23 Aug 2023 13:16:05 +0200 Date: Wed, 23 Aug 2023 13:16:05 +0200 From: Martin Kaiser To: Alexander Stein Cc: Herbert Xu , linux-arm-kernel@lists.infradead.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/3] hwrng: imx-rngc - use polling to wait for end of seeding Message-ID: <20230823111605.sxtf3kriavv6hzxy@viti.kaiser.cx> References: <20230822152553.190858-1-martin@kaiser.cx> <20230822152553.190858-4-martin@kaiser.cx> <5662754.31r3eYUQgx@steina-w> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5662754.31r3eYUQgx@steina-w> User-Agent: NeoMutt/20170113 (1.7.2) Sender: Martin Kaiser X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Hi Alexander, Alexander Stein (alexander.stein@ew.tq-group.com) 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