From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936831AbcCQUqq (ORCPT ); Thu, 17 Mar 2016 16:46:46 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59994 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932832AbcCQUqo convert rfc822-to-8bit (ORCPT ); Thu, 17 Mar 2016 16:46:44 -0400 Date: Thu, 17 Mar 2016 14:46:39 -0600 From: Alex Williamson To: Joe Perches Cc: iommu@lists.linux-foundation.org, dwmw2@infradead.org, joro@8bytes.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 1/2] iommu/vt-d: Ratelimit fault handler Message-ID: <20160317144639.7e0d8dd4@t450s.home> In-Reply-To: <1458246810.9556.22.camel@perches.com> References: <20160317200557.29049.32879.stgit@gimli.home> <20160317201225.29049.43163.stgit@gimli.home> <1458246810.9556.22.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 17 Mar 2016 20:46:43 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 17 Mar 2016 13:33:30 -0700 Joe Perches wrote: > On Thu, 2016-03-17 at 14:12 -0600, Alex Williamson wrote: > > Fault rates can easily overwhelm the console and make the system > > unresponsive.  Ratelimit to allow an opportunity for maintenance. > [] > > diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c > [] > > @@ -1602,10 +1602,17 @@ irqreturn_t dmar_fault(int irq, void *dev_id) > >   int reg, fault_index; > >   u32 fault_status; > >   unsigned long flag; > > + bool ratelimited; > > + static DEFINE_RATELIMIT_STATE(rs, > > +       DEFAULT_RATELIMIT_INTERVAL, > > +       DEFAULT_RATELIMIT_BURST); > > Are these the appropriate limits for dmar? > > include/linux/ratelimit.h:#define DEFAULT_RATELIMIT_INTERVAL    (5 * HZ) > include/linux/ratelimit.h:#define DEFAULT_RATELIMIT_BURST       10 They seem OK to me, I've got a test running that continuously generates DMA read faults and I get 20 lines of log every 5 seconds. That seems like enough to know there's an issue, it's ongoing, and maybe see some patterns in the fault addresses. I expect we could turn up the burst value but generally when I'm looking at the logs I'm only looking for things like is it a single target address, is it a sequential address, or what's the general address space to know if it should or should not be a valid fault address. Thanks, Alex