Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1550507pxb; Fri, 26 Feb 2021 13:57:43 -0800 (PST) X-Google-Smtp-Source: ABdhPJwlFm7KfzAJdIIZ0oJTiTw5cE5KSLTVY6ZCuVaoenc8P8rJPZiqqam1Pk4NZGIBzxfMjrtV X-Received: by 2002:a17:906:1fd2:: with SMTP id e18mr5706191ejt.49.1614376663818; Fri, 26 Feb 2021 13:57:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614376663; cv=none; d=google.com; s=arc-20160816; b=j1wzyikGmRzmcnP5EE3N00NuOfDUpqtXd/bi9Ulu3yVhDVvEfOrNRDAArfE8j4rJHy rW3dF2/Jr/h0nBkwj/2ypXr1OJwhzxXobF2+aQ067gJsC/2aGLzsZ1Qvzto3pZY2nuuw 5Rgd3+cpvtXFbagT9gBpcqcA1AjFQjkaLUxmLvtkhi1VglAXBpTm6czI4Il53SDYU7JE b49lCM1kPnPTE1FPcj/JRRu57e9aHk9UtIF+Jru/ny9M+9TR7h4Ot7mJCo/0mB/WSmr6 CDYaiWYoKEb3gkJL1Nt3BnkbS1Ad6AjAjW0UOf/QnVo5uoMhaGf8+u8PBW/4GD6h3EgR 385g== 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=TbbG+K21OJksMSriRBsOnkJNEbaTjI1alnvlyWlecpQ=; b=xcOSOMMK/cD7mHt71xalkH9+J075OfIhfukxiFBC1lnEPSgkbXvNU50Fi7G5UdbNVv 34KsYKocQ4GJF48MgsfQpu5IEUy9qlMO73mYjY9B9jv++aSqgxAEu3eDNcgJAjCh8Dwm r87pb3ReGzYKahQw6rLuNDH+HUifQ4VETwDYXqitNfimxZC0lZJ4D+/E+NDAkH+V7RAL b8Dz+diR5l7GYus1SLNqigWqcl2AzbxzzVpD8cH55q1tegiIg+xl5SzfL14dyxGt9Gzi mIKYfrohhq53NHJnVZJYCOy8IvjCSEYV9ozxicb2272RVU4JsAWiM4vTG2ug80UVgpBu QyZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=PgkgDjZa; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k2si6737944ejr.529.2021.02.26.13.57.21; Fri, 26 Feb 2021 13:57:43 -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=@linuxfoundation.org header.s=google header.b=PgkgDjZa; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230032AbhBZVz7 (ORCPT + 99 others); Fri, 26 Feb 2021 16:55:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229550AbhBZVz6 (ORCPT ); Fri, 26 Feb 2021 16:55:58 -0500 Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F544C061756 for ; Fri, 26 Feb 2021 13:55:18 -0800 (PST) Received: by mail-io1-xd35.google.com with SMTP id s24so11215881iob.6 for ; Fri, 26 Feb 2021 13:55:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=TbbG+K21OJksMSriRBsOnkJNEbaTjI1alnvlyWlecpQ=; b=PgkgDjZa97MDV9/Y8FaGFSjOFOKXBpNT06a5oxs2Czk9XCjecD+COXpqVKv844w6CB gAOfjg2mIaQFtRaW/ECx/j3YWKsMqhi7ev/2c8a6NMfX9hG+xl1eY+JBWSekfUsMVF1X eZZMhPhIMT57mfWIHBORF8HW0lTc+BQpQx7AA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=TbbG+K21OJksMSriRBsOnkJNEbaTjI1alnvlyWlecpQ=; b=FtGdybxZBWskXcd17jynhmV/UvV8sekGoJvtkK/X/nQR9gWD+Z510uAgNeCcTyE8O7 jfwMfz0XE3sNLejxq1qG46hhRU4xjf0GONwDLy9d45g1uTIjGB/PzKjyYckTVbnJSWq+ 3ivpyWwsh7VD5+/NNXoLRBjShGtnwU6Ogf9Oy/nkAjnqgM6sM9ALGXabTjI3f9jRnj7U azcRuLvaxPE1KDYnVRkl8TvUfxO+Zx2ayT3zEmgTsTYOg3eVs+9lT2LdTVgGznr3Were WSRHVkUg6jk1+u9VkIUZoJqzcFs/5WAG8FHE2qcC5EZ7lgZzDH725QEckV+FuJVpRzSW KYmA== X-Gm-Message-State: AOAM532AKW8YRXY+v+mIo2JszDsy02xN7qkVdzeE8dGsD67W8ncHg9Kt xoogSZzrhRgFQVc9NcJuZA5kug== X-Received: by 2002:a02:4087:: with SMTP id n129mr5042155jaa.143.1614376517727; Fri, 26 Feb 2021 13:55:17 -0800 (PST) Received: from [192.168.1.112] (c-24-9-64-241.hsd1.co.comcast.net. [24.9.64.241]) by smtp.gmail.com with ESMTPSA id x17sm5298087ilm.40.2021.02.26.13.55.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 26 Feb 2021 13:55:17 -0800 (PST) Subject: Re: [PATCH] iommu/amd: Fix event counter availability check To: Paul Menzel , Alexander Monakov , Suravee Suthikulpanit Cc: iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, David Coe , Joerg Roedel , "Tj (Elloe Linux)" , Shuah Khan References: <20200529200738.1923-1-amonakov@ispras.ru> <4aba4c61-1878-3d4e-d52e-3ccac9715010@molgen.mpg.de> From: Shuah Khan Message-ID: Date: Fri, 26 Feb 2021 14:55:16 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <4aba4c61-1878-3d4e-d52e-3ccac9715010@molgen.mpg.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/26/21 2:44 PM, Paul Menzel wrote: > [cc: +suravee, +jörg] > > Dear Alex, dear Shuah, dear Suravee, dear Jörg, > > > Am 03.06.20 um 08:54 schrieb Alexander Monakov: >> On Tue, 2 Jun 2020, Shuah Khan wrote: >> >>> I changed the logic to read config to get max banks and counters >>> before checking if counters are writable and tried writing to all. >>> The result is the same and all of them aren't writable. However, >>> when disable the writable check and assume they are, I can run >> [snip] >> >> This is similar to what I did. I also noticed that counters can >> be successfully used with perf if the initial check is ignored. >> I was considering sending a patch to remove the check and adjust >> the event counting logic to use counters as read-only, but after >> a bit more investigation I've noticed how late pci_enable_device >> is done, and came up with this patch. It's a path of less resistance: >> I'd expect maintainers to be more averse to removing the check >> rather than fixing it so it works as intended (even though I think >> the check should not be there in the first place). >> >> However: >> >> The ability to modify the counters is needed only for sampling the >> events (getting an interrupt when a counter overflows). There's no >> code to do that for these AMD IOMMU counters. A solution I would >> prefer is to not write to those counters at all. It would simplify or >> even remove a bunch of code. I can submit a corresponding patch if >> there's general agreement this path is ok. >> >> What do you think? > > I like this idea. Suravee, Jörg, what do you think? > > Commit 6778ff5b21b (iommu/amd: Fix performance counter initialization) > delays the boot up to 100 ms, which is over 20 % on fast systems, and > also just a workaround, and does not seem to work always. The delay is > also not mentioned in the commit message. > > Sounds good to me. I can test this out on my system. thanks, -- Shuah