Re: [PATCH v2] iommu/iova: silence warnings under memory pressure
From: Qian Cai
Date: Fri Nov 22 2019 - 09:59:26 EST
On Thu, 2019-11-21 at 20:37 -0800, Joe Perches wrote:
> On Thu, 2019-11-21 at 21:55 -0500, Qian Cai wrote:
> > When running heavy memory pressure workloads, this 5+ old system is
> > throwing endless warnings below because disk IO is too slow to recover
> > from swapping. Since the volume from alloc_iova_fast() could be large,
> > once it calls printk(), it will trigger disk IO (writing to the log
> > files) and pending softirqs which could cause an infinite loop and make
> > no progress for days by the ongoimng memory reclaim. This is the counter
> > part for Intel where the AMD part has already been merged. See the
> > commit 3d708895325b ("iommu/amd: Silence warnings under memory
> > pressure"). Since the allocation failure will be reported in
> > intel_alloc_iova(), so just call printk_ratelimted() there and silence
> > the one in alloc_iova_mem() to avoid the expensive warn_alloc().
>
> []
> > v2: use dev_err_ratelimited() and improve the commit messages.
>
> []
> > diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
>
> []
> > @@ -3401,7 +3401,8 @@ static unsigned long intel_alloc_iova(struct device *dev,
> > iova_pfn = alloc_iova_fast(&domain->iovad, nrpages,
> > IOVA_PFN(dma_mask), true);
> > if (unlikely(!iova_pfn)) {
> > - dev_err(dev, "Allocating %ld-page iova failed", nrpages);
> > + dev_err_ratelimited(dev, "Allocating %ld-page iova failed",
> > + nrpages);
>
> Trivia:
>
> This should really have a \n termination on the format string
>
> dev_err_ratelimited(dev, "Allocating %ld-page iova failed\n",
>
>
Why do you say so? It is right now printing with a newline added anyway.
Âhpsa 0000:03:00.0: DMAR: Allocating 1-page iova failed
Âhpsa 0000:03:00.0: DMAR: Allocating 1-page iova failed
Âhpsa 0000:03:00.0: DMAR: Allocating 1-page iova failed
Âhpsa 0000:03:00.0: DMAR: Allocating 1-page iova failed
Âhpsa 0000:03:00.0: DMAR: Allocating 1-page iova failed
Âhpsa 0000:03:00.0: DMAR: Allocating 1-page iova failed
Âhpsa 0000:03:00.0: DMAR: Allocating 1-page iova failed
Âhpsa 0000:03:00.0: DMAR: Allocating 1-page iova failed