From patchwork Tue Feb 19 22:32:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marcin_=C5=9Alusarz?= X-Patchwork-Id: 2165361 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id 1F0C9DF24C for ; Tue, 19 Feb 2013 22:33:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C2F08E668D for ; Tue, 19 Feb 2013 14:33:04 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wi0-f174.google.com (mail-wi0-f174.google.com [209.85.212.174]) by gabe.freedesktop.org (Postfix) with ESMTP id 924AFE5CF6 for ; Tue, 19 Feb 2013 14:32:52 -0800 (PST) Received: by mail-wi0-f174.google.com with SMTP id hi8so5469936wib.13 for ; Tue, 19 Feb 2013 14:32:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=3Cziz8zFNbvSOE33deo9wNHXOOCOFAwQXmWsxtaOUr4=; b=WR/8/OZxyDIEDyjWJYVu5cob2AjR2rEg3lAKtZWzpTcBQYGjUueLyKb4pMmw12Gdug BxfSrVM5eDPC2FfPAypGijH+648w+skIl0f4QezMPMIRXjYH4cn5edsxpbgyoSkh57+8 O+FELesTg86h0fhpINsCB5rDy4jodMDsi/ePgr2G4NYbsP9OtZTKp8atvUFQXAwptYf/ psaaSqVmJPfCcYKJUFY6Bb3k4ba/5dHb/tRO0HDeBRRJNzQDlDI8jWkHm04Um7B9I7pS m3ptDPshS5Up5eIBG9DGhzdDjAcBmBTbsxggZMdzKl4Tm0eVFV0yiuuHHg4+qRxvZHhg G/Sw== X-Received: by 10.180.80.74 with SMTP id p10mr28687814wix.19.1361313171497; Tue, 19 Feb 2013 14:32:51 -0800 (PST) Received: from joi.lan (acdv56.neoplus.adsl.tpnet.pl. [83.9.171.56]) by mx.google.com with ESMTPS id gy2sm30591904wib.3.2013.02.19.14.32.49 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 19 Feb 2013 14:32:50 -0800 (PST) Date: Tue, 19 Feb 2013 23:32:55 +0100 From: Marcin Slusarz To: Jiri Slaby , bskeggs@redhat.com Subject: Re: WARNING: at drivers/gpu/drm/nouveau/core/core/mm.c:242 Message-ID: <20130219223255.GA13522@joi.lan> References: <5122021F.1060207@suse.cz> <20130218232335.GA9730@joi.lan> <5122BC8A.6040503@suse.cz> <20130219070744.GA3032@joi.lan> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20130219070744.GA3032@joi.lan> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: stable , LKML , dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org On Tue, Feb 19, 2013 at 08:07:44AM +0100, Marcin Slusarz wrote: > On Tue, Feb 19, 2013 at 12:43:06AM +0100, Jiri Slaby wrote: > > On 02/19/2013 12:23 AM, Marcin Slusarz wrote: > > > On Mon, Feb 18, 2013 at 11:27:43AM +0100, Jiri Slaby wrote: > > >> Hi, > > >> > > >> we have a report of WARNING from 3.7.6 in nouveau at > > >> drivers/gpu/drm/nouveau/core/core/mm.c:242 here: > > >> https://bugzilla.novell.com/show_bug.cgi?id=802347#c11 > > >> > > >> There is an order 4 allocation failure in nouveau_drm_open -> > > >> nouveau_vm_create, i.e. this one failed: > > >> vm->pgt = kcalloc(vm->lpde - vm->fpde + 1, sizeof(*vm->pgt), GFP_KERNEL); > > >> > > >> Then, on the error path in still in nouveau_drm_open, it is followed by > > >> a call to nouveau_cli_destroy. But that one calls nouveau_vm_ref -> > > >> nouveau_mm_fini -> nouveau_vm_del -> nouveau_mm_fini which triggers the > > >> warning. > > >> > > >> Any ideas? > > > > > > Crash/warning should be fixed by commit cfd376b6bfccf33782a0748a9c70f7f752f8b869 > > > "drm/nouveau/vm: fix memory corruption when pgt allocation fails". > > > > Oh, thanks for the pointer. Could that bug cause real "memory > > corruption"? As we're hunting one there... > > Yes. > > > Isn't this a stable-3.7 candidate? > > Should have been :/. > > > > Tomorrow I'll post a patch for page allocation failure. > > > > What do you mean -- what kind of patch? > > A patch which will change pgt allocation to use vmalloc. --- From: Marcin Slusarz Subject: [PATCH] drm/nouveau: use vmalloc for pgt allocation Page tables on nv50 take 48kB, which can be hard to allocate in one piece. Let's use vmalloc. Signed-off-by: Marcin Slusarz Cc: stable@vger.kernel.org --- drivers/gpu/drm/nouveau/core/subdev/vm/base.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c index 77c67fc..e66fb77 100644 --- a/drivers/gpu/drm/nouveau/core/subdev/vm/base.c +++ b/drivers/gpu/drm/nouveau/core/subdev/vm/base.c @@ -362,7 +362,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length, vm->fpde = offset >> (vmm->pgt_bits + 12); vm->lpde = (offset + length - 1) >> (vmm->pgt_bits + 12); - vm->pgt = kcalloc(vm->lpde - vm->fpde + 1, sizeof(*vm->pgt), GFP_KERNEL); + vm->pgt = vzalloc((vm->lpde - vm->fpde + 1) * sizeof(*vm->pgt)); if (!vm->pgt) { kfree(vm); return -ENOMEM; @@ -371,7 +371,7 @@ nouveau_vm_create(struct nouveau_vmmgr *vmm, u64 offset, u64 length, ret = nouveau_mm_init(&vm->mm, mm_offset >> 12, mm_length >> 12, block >> 12); if (ret) { - kfree(vm->pgt); + vfree(vm->pgt); kfree(vm); return ret; } @@ -446,7 +446,7 @@ nouveau_vm_del(struct nouveau_vm *vm) } nouveau_mm_fini(&vm->mm); - kfree(vm->pgt); + vfree(vm->pgt); kfree(vm); }