Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp173898iob; Mon, 2 May 2022 16:16:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwh8pqU+tg/pluzHUjgWr7Z2lqokeY0SpLtYXg0rNUlm7zUAAzRSdK9dh4Sejr9g2vbe9eK X-Received: by 2002:a05:6a00:15d0:b0:50e:b15:cc43 with SMTP id o16-20020a056a0015d000b0050e0b15cc43mr981050pfu.28.1651533404064; Mon, 02 May 2022 16:16:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651533404; cv=none; d=google.com; s=arc-20160816; b=C3oGkNp4RHrAx97VIv+pTt6Kks+t0mZlXP9P1y4Dc41hfuQ4uvs9gJ2IqHLKttECNR 2hIhuyHe/OeYJ9VsGKWbze+Uq6KPackRQtpHNirxS6zlmjzJQxgcdF1O4aPl9CFzBB+3 Qqkw315ncXz/Pq9hE9lLqXiar9i8r2gOgnknXCoyhW8Hn9WxsuQESZEOAPKlRTMTuJou 8fLjXTsuQB2lmQo4fBWdlXBhSnPz2g6wF3gap8uz7msav330jQJJYXtQGJSqzgdMbB3i g9woPfpEj28d0Joc4nEbpjG1Uo2uuC/bCzWnLhuhgLkDkmGEmTxtJMyH25f05EgOUmpr rGDw== 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 :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=reDZ43oXejCSzozqPypJRqFNR3JRK1p2Z9R+tGdZAzU=; b=aLjD6xYBdW3H2FMOAVfWbBwomaxNVpaHI2GJzKYVBk0xVOQ4VF4kfrgfu/i4wkbpRo J4s2Q9+Ggp6FpXMsGtCZhR1u4COgYGiJmnYzCThCmoAYtjDW5FCqTlGnYEnW3+V47gtF Qvyy3PhmaFivB0SWjB4/jSrtr5pmXvi5PCMP2Az73IUXLOXyE6uh896ZeupR1r+qBa0U JRLi8nCBrcAbJ80Ew6iTCl3gPhHMH4lRuw1lSYD0FJdWIAkI4w3T2gnyxTqeCsN4wAdg OTGRNS1CJ5Oj318U7bTRYhcWAj6rdNnfjmnq7xYnSPodgMnxmNgUQY2RDW2Bs29Expx9 zsng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id x24-20020a1709027c1800b0015cfe719870si13813563pll.222.2022.05.02.16.16.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 16:16:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 2BBA52BB33; Mon, 2 May 2022 16:16:34 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377960AbiD2P2N convert rfc822-to-8bit (ORCPT + 99 others); Fri, 29 Apr 2022 11:28:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbiD2P2L (ORCPT ); Fri, 29 Apr 2022 11:28:11 -0400 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BCB63D4471 for ; Fri, 29 Apr 2022 08:24:52 -0700 (PDT) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-148-H2iRa9rHN0SC6_3kj-vIRQ-1; Fri, 29 Apr 2022 16:24:49 +0100 X-MC-Unique: H2iRa9rHN0SC6_3kj-vIRQ-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.32; Fri, 29 Apr 2022 16:24:48 +0100 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.033; Fri, 29 Apr 2022 16:24:48 +0100 From: David Laight To: "'Maciej W. Rozycki'" , Thomas Bogendoerfer CC: "linux-mips@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: RE: [PATCH] MIPS: Fix CP0 counter erratum detection for R4k CPUs Thread-Topic: [PATCH] MIPS: Fix CP0 counter erratum detection for R4k CPUs Thread-Index: AQHYW7e8izRkWzTXwESA/9rrqnvRW60HAA6w Date: Fri, 29 Apr 2022 15:24:48 +0000 Message-ID: <3582358fb8ae47d7b88f85aa895a7109@AcuMS.aculab.com> References: <20220429100128.GB11365@alpha.franken.de> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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-kernel@vger.kernel.org > That said reading from the 8254 is messy too and you may need a spinlock > (you need to write the Counter Latch or Read-Back command to the control > register and then issue consecutive two reads to the requested timer's > data register[2]). Which is I guess why support for it has been removed > from x86 code. For non-SMP it might be good enough. It is important to 'latch' the counter before reading it. I tried to optimise some code to avoid the extra accesses. In principle it ought to have worked, but reading the unlatched values gave garbage - not just messed up 16bit values. It was probably returning a value that was being ripple-counted. The sheer number of IO cycles you need to read the counters just beggars belief. So while they can be used to get an accurate timestamp it really takes too long to be useful. Even in a modern x86 chipset I think they are still ISA speed cycles. (Mind you, we've an fpga based PCIe boards where reads are ISA speed....) OTOH I'd have though that for a real 486 (one without a TSC) that is the only way to get a high res timer count. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)