From nobody Sat Nov 6 11:05:40 2021 X-Original-To: arm@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id B2296184FE17 for ; Sat, 6 Nov 2021 11:05:41 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HmZKx3V4Nz3NCq for ; Sat, 6 Nov 2021 11:05:41 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from [192.168.0.88] (unknown [195.64.148.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: avg/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 1AD72215D3 for ; Sat, 6 Nov 2021 11:05:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) From: Andriy Gapon To: arm@FreeBSD.org References: <812ab31a-ce6e-d8ac-3539-39e6b20a01df@FreeBSD.org> Subject: Re: huge emmc speed regression Message-ID: <67e6166d-a870-da60-efd4-9bd59fefca71@FreeBSD.org> Date: Sat, 6 Nov 2021 13:05:40 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Firefox/78.0 Thunderbird/78.14.0 List-Id: Porting FreeBSD to ARM processors List-Archive: https://lists.freebsd.org/archives/freebsd-arm List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-arm@freebsd.org MIME-Version: 1.0 In-Reply-To: <812ab31a-ce6e-d8ac-3539-39e6b20a01df@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-ThisMailContainsUnwantedMimeParts: N On 06/11/2021 12:58, Andriy Gapon wrote: > > Upfront, I haven't tested the latest main / current yet. > I should really test it but that's porbably for the next weekend. > > I see a huge emmc speed difference between the current from April 2021 and > September 2021 (commit 5e79bba562bc303eed669dbd0d391b6c6a9c289b) on Orange Pi PC > Plus using on-board eMMC card.  I use MMCCAM in both cases. > > In the old environment I see expected read speeds (with sequential dd) of around > 40 MB/s. > In the new environment the speeds are around 300 KB/s (like a very good floppy > disk of old). > > Some info from the old environment: > # camcontrol mmcsdcmd 2:0:0 -I > Host controller information > Host OCR: 0x300000 > Min frequency: 400 KHz > Max frequency: 52 MHz [snip] > Same command in the new environment looks a bit strange: > # camcontrol mmcsdcmd 2:0:0 -I > Host controller information > Host OCR: 0x300000 > Min frequency: 400 KHz > Max frequency: 0 MHz [snip] It seems that this is because the FDT does not have max-frequency property. The old mmc_fdt_parse() code would leave f_max alone in that case and it was set to 52 MHz by the driver. However, the new code in mmc_fdt_parse(), or rather mmc_parse(), would reset f_max to zero (despite the comment that was carried over): /* * max-frequency is optional, drivers should tweak this value * if it's not present based on the clock that the mmc controller * operates on */ max_freq = 0; device_get_property(dev, "max-frequency", &max_freq, sizeof(uint64_t)); host->f_max = max_freq; -- Andriy Gapon