Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1391880pxb; Fri, 6 Nov 2020 08:29:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJxG4eT2Ni/YbIxKri6S1TkdzDbxrBZhgw84GUJg09PI8DRuhsMgxarSNVGCo94OtJe6tgsQ X-Received: by 2002:a17:906:2f97:: with SMTP id w23mr2966800eji.54.1604680173201; Fri, 06 Nov 2020 08:29:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604680173; cv=none; d=google.com; s=arc-20160816; b=JOrWyFk07ajex5QHvexK3bFTZnNDmcr+GGM1gQurZ//KymNrLGNyCyNpZ3TSN9yvnD B9hJ81JIomwPHKzhvcGV011tFgLwunviusjV14jWMFdzpLsJkaCbMTO3IWzH1IlDaeYJ ecW8irKOfYXQQFRup+60wrUN/UcN6jovqoBv3ZV4ukukwDldCwrT0TfjbChZSRPIu1dl xbnKMBkTgcGhQngj36EyDcTINTTRCQsKk90dkeMcIcLrn8KAMw2280mbv/1196CQGr/6 WXjXM9MbZGUcGNlyux9/oVioykisRRtVZMK4QMA0OOdBaqwQKps4/71OlC+VbaCj/G6u xJMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:in-reply-to:mime-version :user-agent:date:message-id:references:cc:to:from:subject :dkim-signature; bh=SxG8W321K37P/2Nept94VZxZoM7KKo/nS12XQk8CKNk=; b=T2vJFSIrxtDl9eHS7HhuEO6gUUuSJMY99XoU0XVPHBDiy8QL3uWePReUguFzoLaA0a Bq+OUG/0WrQ8mQUZoYhMnIAXZkVnBD83UeLaFYw/DVEry5XHb9WVHSYW1j+O+audL1Be EOho8IDVMQVMFZr6ypSs9wq4amXty73cbbymD4kPQvUU/oD2G2DZ1doFt7mVBGKdq10T HYhXrQW9/UJr8ofketWSlpEGlul87aztt8Ev0e53TYKpBRJEryqIyp6f88oqV65wdbTt Hsp/zM1802VzZ0zePH1VWOGZ+NUmRQQRu814c5XkqDxN7HodemoPmklEtiSsetymGrJB LIhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bitmath.org header.s=20191106 header.b=SFsmAipP; 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 j20si1148467eja.715.2020.11.06.08.29.07; Fri, 06 Nov 2020 08:29:33 -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=SFsmAipP; 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 S1726880AbgKFQ0f (ORCPT + 99 others); Fri, 6 Nov 2020 11:26:35 -0500 Received: from mailrelay1-2.pub.mailoutpod1-cph3.one.com ([46.30.212.0]:60050 "EHLO mailrelay1-2.pub.mailoutpod1-cph3.one.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726250AbgKFQ0f (ORCPT ); Fri, 6 Nov 2020 11:26:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bitmath.org; s=20191106; h=content-type:in-reply-to:mime-version:date:message-id:references:cc:to:from: subject:from; bh=SxG8W321K37P/2Nept94VZxZoM7KKo/nS12XQk8CKNk=; b=SFsmAipPQwR2Ej+GWfwALmQG1dY9mUnDiQ0xGUQCM8C/SnrvRvcpWQtpLf92UF/q6QxgfqxvnBZaZ X+imnkYcJ/31lzotgGQeIImNvUUW0QcEY4jRac6eM7Wqu5JU6owF+ReiocL2luudvkrPIslNlk3ByB kyLqGnqeZNLl7R4WuUtxyun5eiwFWbt8GR+x+EZj1m1e4jtOTo3dSyPxrIVfe9CdhU51Bj0eStE995 RuaiVMcdCloPKMGf/+FlWUZ/mc+YsqxSXTz6+qBn2sl586S28o7UdgF2JU4fTr9/stHGE9Uy71yPgM TeX4Psatzlf8fkuLF1ojxrry7dHy0qQ== X-HalOne-Cookie: 163c5e454e45403160b48d3b89fde72e40892aa8 X-HalOne-ID: d2c0e733-204c-11eb-9654-d0431ea8a283 Received: from [192.168.19.13] (h-155-4-128-97.na.cust.bahnhof.se [155.4.128.97]) by mailrelay1.pub.mailoutpod1-cph3.one.com (Halon) with ESMTPSA id d2c0e733-204c-11eb-9654-d0431ea8a283; Fri, 06 Nov 2020 16:26:29 +0000 (UTC) Subject: Re: [PATCH] applesmc: Re-work SMC comms v2 From: Henrik Rydberg To: Brad Campbell Cc: Arnd Bergmann , linux-hwmon@vger.kernel.org, "linux-kernel@vger.kernel.org" , hns@goldelico.com, Guenter Roeck , Andreas Kemnade , Jean Delvare References: <20200930105442.3f642f6c@aktux> <20200930164446.GB219887@roeck-us.net> <20201002002251.28462e64@aktux> <7543ef85-727d-96c3-947e-5b18e9e6c44d@roeck-us.net> <20201006090226.4275c824@kemnade.info> <68467f1b-cea1-47ea-a4d4-8319214b072a@fnarfbargle.com> <20201104142057.62493c12@aktux> <2436afef-99c6-c352-936d-567bf553388c@fnarfbargle.com> <7a085650-2399-08c0-3c4d-6cd1fa28a365@roeck-us.net> <10027199-5d31-93e7-9bd8-7baaebff8b71@roeck-us.net> <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> Message-ID: Date: Fri, 6 Nov 2020 17:26:42 +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: multipart/mixed; boundary="------------B6F41B33EAEA186500550465" Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a multi-part message in MIME format. --------------B6F41B33EAEA186500550465 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit >> I can't guarantee it won't break older machines which is why I've >> asked for help testing it. I only have a MacbookPro 11,1 and an iMac >> 12,2. It fixes both of those. >> >> Help testing would be much appreciated. > > I see, this makes much more sense. I may be able to run some tests > tonight. Meanwhile, looking at the patch, the status variable in > send_command looks superfluous now that there is a wait_status() before it. Ok, it took some time to get the machines up to speed, but so far I have managed to run some tests on an MacBookAir1,1. I only managed to upgrade up to 4.15, so I had to revert the inputdev polling patch, but the rest applied without problems. I recovered an old test program I used to use (attached), and checked for failures and reads per second *** hwmon: (applesmc) switch to using input device polling mode At this point in the tree, with this reverted, I see 0 failures and 55 reads per second. *** hwmon: (applesmc) avoid overlong udelay() With this applied, I see 0 failures and 16 reads per second. *** hwmon: (applesmc) check status earlier. With this applied, I see 0 failures and 16 reads per second. *** (HEAD -> stable) applesmc: Re-work SMC comms v2 With this applied, the kernel hangs in module probe, and the kernel log is flooded with read failures. So as it stands, it does not work at all. I will continue to check another machine, and see if I can get something working. Henrik --------------B6F41B33EAEA186500550465 Content-Type: application/x-shellscript; name="applesmc-test.sh" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="applesmc-test.sh" IyEvYmluL2Jhc2gKIwojIFRoaXMgc2NyaXB0IHRlc3RzIHRoZSBwcmVzZW5jZSBhbmQgcGVy Zm9ybWFuY2Ugb2YKIyB0aGUgYXBwbGVzbWMgbW9kdWxlIG9uIEFwcGxlIG1hY3RlbCBjb21w dXRlcnMuCiMKIyBrb3N1bWk2OEB1YnVudHVmb3J1bXMub3JnCiMKCmlmIFsgYHdob2FtaWAg IT0gInJvb3QiIF07IHRoZW4KICAgIGVjaG8gInNjcmlwdCBtdXN0IGJlIHJ1biBhcyByb290 IChydW4gd2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YGNhdCAkZGV2L2xpZ2h0IDI+L2Rldi9udWxsYAogICAgaWYgWyAkPyA9 IDAgXTsgdGhlbgogICAgICAgIGVjaG8gLW4gIiwgcmVhZGFibGUsIG91dHB1dDogJG91dCIK ICAgIGVsc2UKICAgICAgICBlY2hvIC1uICIsIG5vdCByZWFkYWJsZSIKICAgIGZpCmVsc2UK ICAgIGVjaG8gLW4gIiBub3QgcHJlc2VudCIKZmkKZWNobwoKIyBMZWRzCmxlZHM9YGxzICRk ZXYvbGVkcy8qL2JyaWdodG5lc3MgMj4vZGV2L251bGxgCmVjaG8gLW4gImxlZHM6ICAgICAg ICAgIgppZiBbICIkbGVkcyIgIT0gIiIgXTsgdGhlbgogICAgZWNobyAiIHByZXNlbnQsIgog ICAgZm9yIHggaW4gJGxlZHM7IGRvCiAgICAgICAgZWNobyAtbiAiIGxlZDogICAgICAgICAg ICAgICAgICAgIgogICAgICAgIG91dD1gY2F0ICR4IDI+L2Rldi9udWxsYAogICAgICAgIGlm IFsgJD8gPSAwIF07IHRoZW4KICAgICAgICAgICAgZWNobyAtbiAicmVhZGFibGUsIG91dHB1 dDogJG91dCIKICAgICAgICBlbHNlCiAgICAgICAgICAgIGVjaG8gLW4gIm5vdCByZWFkYWJs ZSIKICAgICAgICBmaQogICAgICAgIGVjaG8KICAgIGRvbmUKZWxzZQogICAgZWNobyAiIG5v dCBwcmVzZW50IgpmaQoKIyBUZW1wZXJhdHVyZXMKdGVtcHM9YGxzICRkZXYvdGVtcCppbnB1 dCAyPi9kZXYvbnVsbGAKZWNobyAtbiAidGVtcGVyYXR1cmVzOiAiCmlmIFsgIiR0ZW1wcyIg IT0gIiIgXTsgdGhlbgogICAgZWNobyAiIHByZXNlbnQsIgogICAgZm9yIHggaW4gJHRlbXBz OyBkbwogICAgICAgIGVjaG8gLW4gIiB0ZW1wZXJhdHVyZTogICAgICAgICAgICIKICAgICAg ICBvdXQ9YGNhdCAkeCAyPi9kZXYvbnVsbGAKICAgICAgICBpZiBbICQ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