Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp74054ybg; Tue, 2 Jun 2020 16:55:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzen/eD2e8cz71j0JCe3KtzKEZoJt62gJExUa3jWQSMPUigk2w6v+G3d4aNft40EzBLA1W8 X-Received: by 2002:a05:6402:308b:: with SMTP id de11mr12660285edb.181.1591142113384; Tue, 02 Jun 2020 16:55:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591142113; cv=none; d=google.com; s=arc-20160816; b=0vfbI6slNusgPw2CiZMwn7S35EYmhtv0fiRgi71PS6us7PL63ScK/g1g5nv6ACv/1x VxGG+Ueylbkomed/zyx02OA5pZ8eTNUCn5RkH50sfkIPGg9XJK+uXjDUJNYqbFtxtfc3 hMSHwN0VjqPIsfhvcJ+l7ztJ7PNLtjRZWkT15bc60tARJNoamRJJfG+qlI2/qjCiAsn2 w7wGcqOtq2NRzLt6/br2biivUIHjYqqw4VgrlVXCEvn0ZdUMacEmJvg3+jiHFKN5Gesq MgZPOGYF4G5+nFUvil3FIMAL/eWLLbtS3r9BFVL86HD061TQmyy5DyOHSPuemHZJdAty EYug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=AyHVm8H1V2i3mmbLZOQuNvzAiH5+9jtSq16k4ss/D+g=; b=dZ0Zd7fDU87Pa5TA6RDHBkaPHfrnLYgnTMOE9ZeKqovcRxvXqg5SjQZZqlopDi3/iC vmdzexoVVjehQfEiU1fHe63QRTFg2tAUWSa0Es+JNmWSMkvj5Anl5ZluZxUawgPfk/Vt MX8wg0KE7zQPKCxj1zXXa1MzeKQKzZBMVADDO5u01rAIp4lt692+dG//KTGfuCATt92Z VnhO6HThDflNjUHPK7ewQG9EdEsZIAenzpDE+QxDoEC1Sei2xSWCe36XSUAV9esTcNOk //+ji3IJ3U//7MtaDLwzCOCEucarLv5FwLcKikcb3GWRARK4txH9W5eEHtnb3J1hOUQ3 /oiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=google header.b="Mt/tNa3C"; 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 l21si153373eds.400.2020.06.02.16.54.50; Tue, 02 Jun 2020 16:55:13 -0700 (PDT) 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="Mt/tNa3C"; 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 S1728341AbgFBXwD (ORCPT + 99 others); Tue, 2 Jun 2020 19:52:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33438 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726589AbgFBXwD (ORCPT ); Tue, 2 Jun 2020 19:52:03 -0400 Received: from mail-ot1-x343.google.com (mail-ot1-x343.google.com [IPv6:2607:f8b0:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 116BBC08C5C0 for ; Tue, 2 Jun 2020 16:52:02 -0700 (PDT) Received: by mail-ot1-x343.google.com with SMTP id o13so423873otl.5 for ; Tue, 02 Jun 2020 16:52:02 -0700 (PDT) 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=AyHVm8H1V2i3mmbLZOQuNvzAiH5+9jtSq16k4ss/D+g=; b=Mt/tNa3CVtFoIPP9vs1G/pzU5s4Hc6kChAN1MjUSn58bltrswAMU5AiNUP9Mv+2kcT a0Y+fguR9tlG17LumUx/nVW31QoG9Ug8bjp5s8nsUGMBAh/HdduyvCCg86G5877Cg3GZ e/JVfVdPupzlXxohI4txQdgepZULQhGfZ+0wc= 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=AyHVm8H1V2i3mmbLZOQuNvzAiH5+9jtSq16k4ss/D+g=; b=uOqDPxTXzBElYJj20nSIupII66yiXb0LgKkvUpCFA55CVed3JBFD9Hi0sEJ3pyP02h 7eneiewUbZEWmkeOe7WqqfFCPXModU3AWr7DoGqRNqJ/fFhn2IJBHWGzJCHRdbIAa7dU cfXqfjJAhwTzQ7cz03TwGEVxgX/kwmV7y8fhO2a74as1dGYNM4GWoLh69EvmiUl+3kw3 OqnW1qN2avdKZbzHhyTDwXi58xwYs7AL1nGwlMe0+JE9kr2YAuKwKsANronVr61yr03A 1xI157DOWd62NsvJCWPqSKsxD4EWmrMgFNHzPtBjgqfTImUscjQ+M83Zo5KS3AxKEGB2 HCwg== X-Gm-Message-State: AOAM533HbGseuOLmNInIMH25gLhDlaNmskCgez2s/3Gi1HH03jPQLfK6 tKFBzOLOcP1DvfTlcas5znv5sg== X-Received: by 2002:a9d:3bc2:: with SMTP id k60mr1217092otc.242.1591141921377; Tue, 02 Jun 2020 16:52:01 -0700 (PDT) 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 k7sm81222oon.29.2020.06.02.16.52.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 02 Jun 2020 16:52:00 -0700 (PDT) Subject: Re: [PATCH] iommu/amd: Fix event counter availability check To: Alexander Monakov , linux-kernel@vger.kernel.org Cc: Joerg Roedel , Suravee Suthikulpanit , iommu@lists.linux-foundation.org, skhan@linuxfoundation.org References: <20200529200738.1923-1-amonakov@ispras.ru> From: Shuah Khan Message-ID: Date: Tue, 2 Jun 2020 17:51:59 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/31/20 1:22 AM, Alexander Monakov wrote: > Hi, > > Adding Shuah Khan to Cc: I've noticed you've seen this issue on Ryzen 2400GE; > can you have a look at the patch? Would be nice to know if it fixes the > problem for you too. > I am not seeing any change in behavior on my system. I still see: I can't read perf counters. The question I asked in my previous thread on this: -------------------------------------------------------------------- I see 2 banks and 4 counters on my system. Is it sufficient to check the first bank and first counter? In other words, if the first one isn't writable, are all counters non-writable? Should we read the config first and then, try to see if any of the counters are writable? I have a patch that does that, I can send it out for review. 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 perf stat -e 'amd_iommu_0 on all events and get data. perf stat -e 'amd_iommu_0/cmd_processed/' sleep 10 Performance counter stats for 'system wide': 56 amd_iommu_0/cmd_processed/ 10.001525171 seconds time elapsed perf stat -a -e amd_iommu/mem_trans_total/ sleep 10 Performance counter stats for 'system wide': 2,696 amd_iommu/mem_trans_total/ 10.001465115 seconds time elapsed I tried all possible events listed under amd_iommu_0 and I can get data on all of them. No problems in dmesg. -------------------------------------------------------------------- This patch doesn't really address that question. thanks, -- Shuah