From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9F1F4ECE59E for ; Wed, 16 Oct 2019 00:48:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 814B12067B for ; Wed, 16 Oct 2019 00:48:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388616AbfJPAsW (ORCPT ); Tue, 15 Oct 2019 20:48:22 -0400 Received: from mga07.intel.com ([134.134.136.100]:12460 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726362AbfJPAsV (ORCPT ); Tue, 15 Oct 2019 20:48:21 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 Oct 2019 17:48:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,301,1566889200"; d="scan'208";a="194683484" Received: from allen-box.sh.intel.com (HELO [10.239.159.136]) ([10.239.159.136]) by fmsmga008.fm.intel.com with ESMTP; 15 Oct 2019 17:48:18 -0700 Cc: baolu.lu@linux.intel.com, joro@8bytes.org, bhelgaas@google.com, dwmw2@infradead.org, neugebar@amazon.co.uk Subject: Re: [PATCH 0/2] iommu/dmar: expose fault counters via sysfs To: Yuri Volchkov , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org References: <20191015151112.17225-1-volchkov@amazon.de> From: Lu Baolu Message-ID: <005c9cae-be2a-80a7-6e78-ed535160350a@linux.intel.com> Date: Wed, 16 Oct 2019 08:45:55 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20191015151112.17225-1-volchkov@amazon.de> 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 Hi, On 10/15/19 11:11 PM, Yuri Volchkov wrote: > For health monitoring, it can be useful to know if iommu is behaving as > expected. DMAR faults can be an indicator that a device: > - has been misconfigured, or > - has experienced a hardware hiccup and replacement should > be considered, or > - has been issuing faults due to malicious activity > > Currently the only way to check if there were any DMAR faults on the > host is to scan the dmesg output. However this approach is not very > elegant. The information we are looking for can be wrapped out of the > buffer, or masked (since it is a rate-limited print) by another > device. > > The series adds counters for DMAR faults and exposes them via sysfs. > We now have an iommu API named iommu_register_fault_handler() to register callbacks for dmar faults. How about monitoring the dmar fault through this api so that your code could be generic and vendor agnostic? Best regards, Baolu > Yuri Volchkov (2): > iommu/dmar: collect fault statistics > iommu/dmar: catch early fault occurrences > > drivers/iommu/dmar.c | 182 ++++++++++++++++++++++++++++++++---- > drivers/iommu/intel-iommu.c | 1 + > drivers/pci/pci-sysfs.c | 20 ++++ > include/linux/intel-iommu.h | 4 + > include/linux/pci.h | 11 +++ > 5 files changed, 201 insertions(+), 17 deletions(-) >