Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp2529567pxb; Sun, 8 Nov 2020 04:07:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJz4b6+FLeve43yn03JB4NQ1oBRczILni933fpPFFuh1xKwAip7YawTc/ijAgyImiJhimlW7 X-Received: by 2002:a05:6402:150d:: with SMTP id f13mr10374396edw.119.1604837230442; Sun, 08 Nov 2020 04:07:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604837230; cv=none; d=google.com; s=arc-20160816; b=dK6zwJp0QOa3/INj+VzQ1NqTEsE9l9/x4tdleyNLgeHJqcsFffoAtfN9CvoEKNm7/O sGeMEXjKDCDKouWneV51zXYCvyvdT6xp+ivkwBq7twygHXjchWTPoIilnB9hoAcF1wbU fJ4rcQejahvzA0mVy6EMYEiubDqny3/XnYmj+p7kRCzQcEEZL37HM8rqegvwWwGlwp3X BR/onV6z8dSLrF7/VeBBwGWvRMjWwBi7jn9OjdROyZu/gIFM18bz3fD8deVKFpCGbZVH e9DmmMsdZ03YDC51CH0gOsr0mBXT+qcJ1Ik5eMcI19IdPOu59SV1blYuKkBQQkoPAXi7 7VZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=cK24sQlDTwMS0988AqreL/OWkybNBUC25kHUvCli+HA=; b=kCuKEEdlFIBleOrvW6u7i0DD/eXtEQxzt9B3uZk/sYIgkDP6dxyYuj5pWz1QMtkuUP bk0oMC1jWD3Ds4gyKUNlEVgwA4uW/q53bRKfN3ZxuZQqXnpnGboSs359wZ2TWUvq6K6t Ij9siYeevgs8DUHuDrSO+FriKjrvNdYDcn9lsLV4Ii0jyd+8kVsyphDNYLuA61zxASqb 2fplMsuQ3DhIW2DcIV/qcvKgLgeTsRRO33pkm/F23+kBd9fKbaJqYL6NXVx2aym9MKQX rtPt0K9ncHSLcz9p9Tqc3iTbQj1akg/ooypszROII39w3idyNaSPIaLYVTVlUKTSswON +wrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bitmath.org header.s=20191106 header.b=kams2iYm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j16si4826754eja.72.2020.11.08.04.06.46; Sun, 08 Nov 2020 04:07:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@bitmath.org header.s=20191106 header.b=kams2iYm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728106AbgKHMEY (ORCPT + 99 others); Sun, 8 Nov 2020 07:04:24 -0500 Received: from mailrelay4-2.pub.mailoutpod1-cph3.one.com ([46.30.212.3]:59702 "EHLO mailrelay4-2.pub.mailoutpod1-cph3.one.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726607AbgKHMEX (ORCPT ); Sun, 8 Nov 2020 07:04:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bitmath.org; s=20191106; h=content-transfer-encoding:content-type:in-reply-to:mime-version:date: message-id:from:references:cc:to:subject:from; bh=cK24sQlDTwMS0988AqreL/OWkybNBUC25kHUvCli+HA=; b=kams2iYmdueo/9rlztHCPnuUJfdIS1d/rrC/v0zF5KzH9h9TCEecofobzM998Y95gzuJhKYr0ee9C ehg4X/k7RSvfU73+Rkyo2B6YegYS7u/xh+iNeXTY+Z1QHMFgjXR7ri/IjfXQ9jySAfpuG2XSloRMHh cYlu4KLFyprQIEfzpUFpbGGKZZyc46OQBYfKWGBqFok22JjUxFNCz7D/5ksxvSBMDRgXQkbE06M/Xm +4kvHfAQa8FUdPAxUczsSLsnu7oEqL5/XfzRjdmXTQdregCkjRNap3HD0zfWJ5ZkzT4Alhswn8NBjh Iol9yVTDZHGhZaNUku6UL+oIccj5S4Q== X-HalOne-Cookie: 893d880919a1bc3da693fb6cde4714added48034 X-HalOne-ID: 887ff14d-21ba-11eb-bb7e-d0431ea8bb10 Received: from [192.168.19.13] (h-155-4-128-97.na.cust.bahnhof.se [155.4.128.97]) by mailrelay4.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id 887ff14d-21ba-11eb-bb7e-d0431ea8bb10; Sun, 08 Nov 2020 12:04:20 +0000 (UTC) Subject: Re: [PATCH v3] applesmc: Re-work SMC comms To: Brad Campbell , Andreas Kemnade Cc: Arnd Bergmann , linux-hwmon@vger.kernel.org, "linux-kernel@vger.kernel.org" , hns@goldelico.com, Guenter Roeck , Jean Delvare References: <70331f82-35a1-50bd-685d-0b06061dd213@fnarfbargle.com> <3c72ccc3-4de1-b5d0-423d-7b8c80991254@fnarfbargle.com> <6d071547-10ee-ca92-ec8b-4b5069d04501@bitmath.org> <8e117844-d62a-bcb1-398d-c59cc0d4b878@fnarfbargle.com> <9109d059-d9cb-7464-edba-3f42aa78ce92@bitmath.org> <5310c0ab-0f80-1f9e-8807-066223edae13@bitmath.org> <57057d07-d3a0-8713-8365-7b12ca222bae@fnarfbargle.com> <41909045-9486-78d9-76c2-73b99a901b83@bitmath.org> <20201108101429.GA28460@mars.bitmath.org> From: Henrik Rydberg Message-ID: Date: Sun, 8 Nov 2020 13:04:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-11-08 12:57, Brad Campbell wrote: > On 8/11/20 9:14 pm, Henrik Rydberg wrote: >> On Sun, Nov 08, 2020 at 09:35:28AM +0100, Henrik Rydberg wrote: >>> Hi Brad, >>> >>> On 2020-11-08 02:00, Brad Campbell wrote: >>>> G'day Henrik, >>>> >>>> I noticed you'd also loosened up the requirement for SMC_STATUS_BUSY in read_smc(). I assume >>>> that causes problems on the early Macbook. This is revised on the one sent earlier. >>>> If you could test this on your Air1,1 it'd be appreciated. >>> >>> No, I managed to screw up the patch; you can see that I carefully added the >>> same treatment for the read argument, being unsure if the BUSY state would >>> remain during the AVAILABLE data phase. I can check that again, but >>> unfortunately the patch in this email shows the same problem. >>> >>> I think it may be worthwhile to rethink the behavior of wait_status() here. >>> If one machine shows no change after a certain status bit change, then >>> perhaps the others share that behavior, and we are waiting in vain. Just >>> imagine how many years of cpu that is, combined. ;-) >> >> Here is a modification along that line. >> >> Compared to your latest version, this one has wait_status() return the >> actual status on success. Instead of waiting for BUSY, it waits for >> the other status bits, and checks BUSY afterwards. So as not to wait >> unneccesarily, the udelay() is placed together with the single >> outb(). The return value of send_byte_data() is augmented with >> -EAGAIN, which is then used in send_command() to create the resend >> loop. >> >> I reach 41 reads per second on the MBA1,1 with this version, which is >> getting close to the performance prior to the problems. > > G'day Henrik, > > I like this one. It's slower on my laptop (40 rps vs 50 on the MacbookPro11,1) and the same 17 rps on the iMac 12,2 but it's as reliable > and if it works for both of yours then I think it's a winner. I can't really diagnose the iMac properly as I'm 2,800KM away and have > nobody to reboot it if I kill it. 5.7.2 gives 20 rps, so 17 is ok for me. > > Andreas, could I ask you to test this one? > > Odd my original version worked on your Air3,1 and the other 3 machines without retry. > I wonder how many commands require retries, how many retires are actually required, and what we are going wrong on the Air1,1 that requires > one or more retries. > > I just feels like a brute force approach because there's something we're missing. I would think you are right. There should be a way to follow the status changes in realtime, so one can determine handshake and processing from that information. At least, with this change, we are making the blunt instrument a little smaller. Cheers, Henrik