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=-6.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 CC4EEC76186 for ; Wed, 24 Jul 2019 03:53:12 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7A9BE2087B for ; Wed, 24 Jul 2019 03:53:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7A9BE2087B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 45thJk0B5XzDqGP for ; Wed, 24 Jul 2019 13:53:09 +1000 (AEST) Received: from ozlabs.org (bilbo.ozlabs.org [IPv6:2401:3900:2:1::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 45tGs72dVyzDqQj for ; Tue, 23 Jul 2019 21:46:19 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=ellerman.id.au Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 45tGs671wzz9s3l; Tue, 23 Jul 2019 21:46:18 +1000 (AEST) From: Michael Ellerman To: Alexey Kardashevskiy , linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH kernel] powerpc/pseries/iommu: Add cond_resched() for huge updates In-Reply-To: <20190722082821.37310-1-aik@ozlabs.ru> References: <20190722082821.37310-1-aik@ozlabs.ru> Date: Tue, 23 Jul 2019 21:46:17 +1000 Message-ID: <87r26h55yu.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexey Kardashevskiy Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" Alexey Kardashevskiy writes: > Mapping ~5.000.000 TCEs currently takes about 40s; this is the amount > required for a 300GB VM with 64k IOMMU page size. Anything bigger than > this produces RCU stall warnings. OK. Are we sure we're not doing anything stupid in that code to make it go that slowly? > This adds cond_resched() to allow the scheduler to do context switching > when it decides to. > > This loop is called from dma_set_mask() which is a sleepable context. > > Signed-off-by: Alexey Kardashevskiy > --- > arch/powerpc/platforms/pseries/iommu.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/powerpc/platforms/pseries/iommu.c b/arch/powerpc/platforms/pseries/iommu.c > index 889dc2e44b89..2b8de822272f 100644 > --- a/arch/powerpc/platforms/pseries/iommu.c > +++ b/arch/powerpc/platforms/pseries/iommu.c > @@ -459,6 +459,7 @@ static int tce_setrange_multi_pSeriesLP(unsigned long start_pfn, > static int tce_setrange_multi_pSeriesLP_walk(unsigned long start_pfn, > unsigned long num_pfn, void *arg) > { > + cond_resched(); > return tce_setrange_multi_pSeriesLP(start_pfn, num_pfn, arg); > } Why there and not in tce_setrange_multi_pSeriesLP() ? I'm not sure what the maximum granularity walk_system_ram_range() will ever call us with is. cheers