Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp506482imm; Fri, 27 Jul 2018 00:43:56 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdnX/fFh2Np22hIRFEWY+ltvzWHhiqmD8ipQqTHGh2ujGVea18Pzz5Sk0uhtw/6l9IVp2F9 X-Received: by 2002:a63:2013:: with SMTP id g19-v6mr5022392pgg.68.1532677435972; Fri, 27 Jul 2018 00:43:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532677435; cv=none; d=google.com; s=arc-20160816; b=nzozpszMtq0yyXqTNvyATCZLnSqLnxbXje9dRnVTf//ZVV7k2mWoN24qE2WPZLIIOs Z0i1WxtlJCavIbrTZYfu9fOTuwhbqaw5Q8LHjqmJ6YVfIAq3TrQHjXkSFg0k1BF+0955 1d8XGNAdh1Sf43NuTcuHVH91T9FNeQsi3NzA9dtEEkcjPmQyqlaFm8gaMEdVKATD8PXE I8YCHLIH+s5bn39UcyrE9EoDGaxyXwCVDfYnds6z2LYYithzyFKF8KBLWB7RwI2VR7li WT9fkSCkRs8f6euToU2cuhz0hZ/thM8FC17dUadppdo3HAsZAT0rdcY3ADsWvqT7QDds 9bbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=z3lOv17ogYk2NThetuEvfgZqTzAXNiwEX8E6aRMqTGg=; b=t7bsiiHCvp6CtV1XnKDFvJS/4VCY7Tgw0GFc0wfesybv/ZSvZuVzDiTWwrN8FGTEu5 H90MHvFKJR5QbiTQr6pXFyvasLy6iHcz2cvi5F+u27wU53hb26orbQxCyY1HVCFeQmp1 /tXqBdS4ul43BwDgbcxAT5vji4apANbvxAM1cToSOFFto4jF9HMSevQuwSVr5zzRls4Z GcL1TA2s4TL+YMpQgYg0P1LjHkq/aAKXX+vUsO37GsURssjVgt+fgwxuvRpr6HX/CnQC +kSwctSUAcmwVRQp5QxuHtVkmFbXlgRlFMC6jJds+EVG4lE7Lt4pnr8EX/DpyeR6tjpk GQ8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@8bytes.org header.s=mail-1 header.b=K8Ia9qsr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y78-v6si3758945pfj.159.2018.07.27.00.43.41; Fri, 27 Jul 2018 00:43:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@8bytes.org header.s=mail-1 header.b=K8Ia9qsr; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730142AbeG0JCb (ORCPT + 99 others); Fri, 27 Jul 2018 05:02:31 -0400 Received: from 8bytes.org ([81.169.241.247]:32836 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729445AbeG0JCb (ORCPT ); Fri, 27 Jul 2018 05:02:31 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id 1B36B25A; Fri, 27 Jul 2018 09:41:53 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=8bytes.org; s=mail-1; t=1532677313; bh=5fNy9WJLM20ClCpqC8t1dGhy/jtYxpMBE27+rfeeXA0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=K8Ia9qsrTMjnvy/tAJLj9zAIiRS9FP8KTNZ5H/qTt+LlJqQ18v3+VABoLDfDO+2pD Q6+FxF7+aZeSi0aamLHCh0/8GpLYomNNQ5ofoamIH2zoX2HOUtEecICln9jxFz2dSG qpTj37kR4aJyisHQYTqQH64aTpoTzUos677K9ElIQoYOnWTt+CPv5fzBRXPf8pJ/nX CRBcpEXWEpgQcgu3zvAYsUmX99gZtEOsjP0yyxqsIxNgcXQl/uHU0B0s8wIKCoWnBm 8+rJC+N05hyk0lV/LP6Hg4Sj/RzpNEB9knuCoZrdYZaMZnbMEGGknft3g8zuCjX0ke JBrX98deQbu0w== Date: Fri, 27 Jul 2018 09:41:52 +0200 From: Joerg Roedel To: Geert Uytterhoeven Cc: Magnus Damm , Laurent Pinchart , iommu@lists.linux-foundation.org, linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] iommu/ipmmu-vmsa: Fix allocation in atomic context Message-ID: <20180727074152.bmso3y4lr53ixo2f@8bytes.org> References: <20180720161659.29800-1-geert+renesas@glider.be> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180720161659.29800-1-geert+renesas@glider.be> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 20, 2018 at 06:16:59PM +0200, Geert Uytterhoeven wrote: > When attaching a device to an IOMMU group with > CONFIG_DEBUG_ATOMIC_SLEEP=y: > > BUG: sleeping function called from invalid context at mm/slab.h:421 > in_atomic(): 1, irqs_disabled(): 128, pid: 61, name: kworker/1:1 > ... > Call trace: > ... > arm_lpae_alloc_pgtable+0x114/0x184 > arm_64_lpae_alloc_pgtable_s1+0x2c/0x128 > arm_32_lpae_alloc_pgtable_s1+0x40/0x6c > alloc_io_pgtable_ops+0x60/0x88 > ipmmu_attach_device+0x140/0x334 > > ipmmu_attach_device() takes a spinlock, while arm_lpae_alloc_pgtable() > allocates memory using GFP_KERNEL. Originally, the ipmmu-vmsa driver > had its own custom page table allocation implementation using > GFP_ATOMIC, hence the spinlock was fine. > > Fix this by replacing the spinlock by a mutex, like the arm-smmu driver > does. > > Fixes: f20ed39f53145e45 ("iommu/ipmmu-vmsa: Use the ARM LPAE page table allocator") > Signed-off-by: Geert Uytterhoeven > --- > drivers/iommu/ipmmu-vmsa.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) Applied, thanks.