Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp3939160ybg; Sun, 7 Jun 2020 15:57:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwgyMpqSOpAgw+/Q/JuKYaWR7eupoK02DHSf1IRxrOVRGKs+W1E94RZt0EmC6acGaa5F5lh X-Received: by 2002:aa7:c81a:: with SMTP id a26mr20210005edt.353.1591570635070; Sun, 07 Jun 2020 15:57:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591570635; cv=none; d=google.com; s=arc-20160816; b=jWdMJhnajYuRNg8ivG3GTFS2L5s/4WVCnJYcFyW5Xzcw4zXj6C7gK6grZS8nEciWpa T1jNQC/u0eyLkSjolDOZRllBq8Ucgv1nvj85y7fFJSa11Tt7YFsg64MFoPsMdrmnByV9 BH37ziuUlYHTTWZBHGvszDuLIGY1T5l0JUSSD7YWm3yy7fOQkRoLJMwMC7TwlvIkIdzV MRSBm+TVHAWqw2wBUa6BKkR2SEpQdxIKKouo5420MRnMG+GyPMvGycDQtx+EAGE/iKFp hBC5wB7MN6mZ+MAxAyXaRd+8QUoQOPX1mF08b72R/lRGEvUqdX6vQEJ08NmQ5PpEnGVs tolQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:message-id :mime-version:in-reply-to:references:cc:to:subject:from:date :dkim-signature; bh=OVgJpBhhhhk5NwW2tudXI5m0eiQU8G4TUKDcix9LmsY=; b=WtSboBMIziRlkNuKej+YKsom+UDIYJP139TeWMbOEwwjjTYOq3cjzzkVoZHC7aaN9Z kocOd5wmhO9F4L1S18Clf9udP1OYuWwlG6o3AkWd9Bix6GoO7NDWf+4IrLx5jSjeQqjS 5uz77nb0j0kRp4xYhjC2q8AZbtlDxxfFGPko7KVhymLnzIOOxcHzTbMeKO0b5TruJbA0 HCH2xS4Ly8tIzu0sKyovOL5EdkC7qP+JMmXTH7SasK5GbQZ1kMbRMH/t4rdgH/zqJVQI sJj/ul4BoKUrNM6jQxIl75qBtoWnQejiFOIyhl8ItuSLiAfDKAiobJ3IM5SbvKanTjKY Lpng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@yahoo.ca header.s=s2048 header.b="JvS/cP/Q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=yahoo.ca Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w10si7460565eji.227.2020.06.07.15.56.47; Sun, 07 Jun 2020 15:57:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@yahoo.ca header.s=s2048 header.b="JvS/cP/Q"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=yahoo.ca Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727055AbgFGWxi (ORCPT + 99 others); Sun, 7 Jun 2020 18:53:38 -0400 Received: from sonic302-22.consmr.mail.gq1.yahoo.com ([98.137.68.148]:33186 "EHLO sonic302-22.consmr.mail.gq1.yahoo.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726764AbgFGWxi (ORCPT ); Sun, 7 Jun 2020 18:53:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.ca; s=s2048; t=1591570417; bh=OVgJpBhhhhk5NwW2tudXI5m0eiQU8G4TUKDcix9LmsY=; h=Date:From:Subject:To:Cc:References:In-Reply-To:From:Subject; b=JvS/cP/QAY94+2UYF1anFgfmEPAkfPx8Q7+0fDcUkUPKK9avDW+BUj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15_tiqvSAsrb6ZDaEWAjFEt18Iei0cawqvOnNmgbBHXylk8SdC6.qR4moTrnA3 5RBJ_n6rXNn2vb6Fbjs5JZttjYQyvjvDljpcoZYS7WaMhxwJNpqkPhTIQvDkYMAP0_zDC.kLv.JT O16MfDFOhSP_wDcIgFGs3Zg_9Qdk8VS1Iisdz3CWqoGQCJ5zTSG85FFPOr8kBti6aHZKQEn024Yt 3twmbQtNfk.WFYJrEukQCrRDq4CSw1u9PAEb80O8ouX3nIuH.CL3wsRNquu9MRfiz3IK2seoM9Xa f9xNIjW76MCpJmyABW9ydtiCWJ8gUBi3Fx8FMAiwanA_IFzW90A7mVPWCD0rO1gvdQY0aOw8_hmb a0jN5wMi5hXtO3XVlj7CHbGin6EcRZW2IJnprFsyB_qVqxsXtkHQ0lnse6jb5731sGLhokRIsGUq .pAOc8C_qFEt3Wx_pIFf3oaoecZFcUlc082CY7spy8E3Qt5.7IRBQUNvVCuadbrvu3zte.9z1My0 6dA18TT32QtIhxB5sTW8IOldctvr7doFGvhi_BROtN.PWwbm7xti0bTqhee7rxZZv2b.k8ZAdew9 R8qk.cGXlW6DpLXZTh3D2r2I4mDTCHg7dL4hAJVbKoNtVOWZF6kU03QqAbnXWs5rAz2mZ37tvRWB eVURHxYRHLzSMRlhh Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.gq1.yahoo.com with HTTP; Sun, 7 Jun 2020 22:53:37 +0000 Received: by smtp423.mail.ne1.yahoo.com (VZM Hermes SMTP Server) with ESMTPA ID fcfa050da610cf30279390720f9d5e2e; Sun, 07 Jun 2020 22:53:35 +0000 (UTC) Date: Sun, 07 Jun 2020 18:53:32 -0400 From: "Alex Xu (Hello71)" Subject: Re: 82fef0ad811f "x86/mm: unencrypted non-blocking DMA allocations use coherent pools" was Re: next-0519 on thinkpad x60: sound related? window manager crash To: David Rientjes Cc: alsa-devel@alsa-project.org, bp@alien8.de, hch@infradead.org, hch@lst.de, hpa@zytor.com, linux-kernel@vger.kernel.org, mingo@redhat.com, perex@perex.cz, tglx@linutronix.de, tiwai@suse.com, x86@kernel.org, Pavel Machek References: <20200520111136.GA3802@amd> <1591545088.74ii116nf2.none@localhost> <20200607163803.GA10303@duo.ucw.cz> In-Reply-To: MIME-Version: 1.0 Message-Id: <1591570155.2tn9o40h95.none@localhost> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Mailer: WebService/1.1.16072 hermes_yahoo Apache-HttpAsyncClient/4.1.4 (Java/11.0.6) Content-Length: 5386 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Excerpts from David Rientjes's message of June 7, 2020 3:41 pm: > On Sun, 7 Jun 2020, Pavel Machek wrote: >=20 >> > I have a similar issue, caused between aaa2faab4ed8 and b170290c2836. >> >=20 >> > [ 20.263098] BUG: unable to handle page fault for address: ffffb2b58= 2cc2000 >> > [ 20.263104] #PF: supervisor write access in kernel mode >> > [ 20.263105] #PF: error_code(0x000b) - reserved bit violation >> > [ 20.263107] PGD 3fd03b067 P4D 3fd03b067 PUD 3fd03c067 PMD 3f8822067= PTE 8000273942ab2163 >> > [ 20.263113] Oops: 000b [#1] PREEMPT SMP >> > [ 20.263117] CPU: 3 PID: 691 Comm: mpv Not tainted 5.7.0-11262-gb170= 290c2836 #1 >> > [ 20.263119] Hardware name: To Be Filled By O.E.M. To Be Filled By O= .E.M./B450 Pro4, BIOS P4.10 03/05/2020 >> > [ 20.263125] RIP: 0010:__memset+0x24/0x30 >> > [ 20.263128] Code: cc cc cc cc cc cc 0f 1f 44 00 00 49 89 f9 48 89 d= 1 83 e2 07 48 c1 e9 03 40 0f b6 f6 48 b8 01 01 01 01 01 01 01 01 48 0f af c= 6 48 ab 89 d1 f3 aa 4c 89 c8 c3 90 49 89 f9 40 88 f0 48 89 d1 f3 >> > [ 20.263131] RSP: 0018:ffffb2b583d07e10 EFLAGS: 00010216 >> > [ 20.263133] RAX: 0000000000000000 RBX: ffff8b8000102c00 RCX: 000000= 0000004000 >> > [ 20.263134] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffb2= b582cc2000 >> > [ 20.263136] RBP: ffff8b8000101000 R08: 0000000000000000 R09: ffffb2= b582cc2000 >> > [ 20.263137] R10: 0000000000005356 R11: ffff8b8000102c18 R12: 000000= 0000000000 >> > [ 20.263139] R13: 0000000000000000 R14: ffff8b8039944200 R15: ffffff= ff9794daa0 >> > [ 20.263141] FS: 00007f41aa4b4200(0000) GS:ffff8b803ecc0000(0000) k= nlGS:0000000000000000 >> > [ 20.263143] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 >> > [ 20.263144] CR2: ffffb2b582cc2000 CR3: 00000003b6731000 CR4: 000000= 00003406e0 >> > [ 20.263146] Call Trace: >> > [ 20.263151] ? snd_pcm_hw_params+0x3f3/0x47a >> > [ 20.263154] ? snd_pcm_common_ioctl+0xf2/0xf73 >> > [ 20.263158] ? snd_pcm_ioctl+0x1e/0x29 >> > [ 20.263161] ? ksys_ioctl+0x77/0x91 >> > [ 20.263163] ? __x64_sys_ioctl+0x11/0x14 >> > [ 20.263166] ? do_syscall_64+0x3d/0xf5 >> > [ 20.263170] ? entry_SYSCALL_64_after_hwframe+0x44/0xa9 >> > [ 20.263173] Modules linked in: uvcvideo videobuf2_vmalloc videobuf2= _memops videobuf2_v4l2 videodev snd_usb_audio videobuf2_common snd_hwdep sn= d_usbmidi_lib input_leds snd_rawmidi led_class >> > [ 20.263182] CR2: ffffb2b582cc2000 >> > [ 20.263184] ---[ end trace c6b47a774b91f0a0 ]--- >> > [ 20.263187] RIP: 0010:__memset+0x24/0x30 >> > [ 20.263190] Code: cc cc cc cc cc cc 0f 1f 44 00 00 49 89 f9 48 89 d= 1 83 e2 07 48 c1 e9 03 40 0f b6 f6 48 b8 01 01 01 01 01 01 01 01 48 0f af c= 6 48 ab 89 d1 f3 aa 4c 89 c8 c3 90 49 89 f9 40 88 f0 48 89 d1 f3 >> > [ 20.263192] RSP: 0018:ffffb2b583d07e10 EFLAGS: 00010216 >> > [ 20.263193] RAX: 0000000000000000 RBX: ffff8b8000102c00 RCX: 000000= 0000004000 >> > [ 20.263195] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffb2= b582cc2000 >> > [ 20.263196] RBP: ffff8b8000101000 R08: 0000000000000000 R09: ffffb2= b582cc2000 >> > [ 20.263197] R10: 0000000000005356 R11: ffff8b8000102c18 R12: 000000= 0000000000 >> > [ 20.263199] R13: 0000000000000000 R14: ffff8b8039944200 R15: ffffff= ff9794daa0 >> > [ 20.263201] FS: 00007f41aa4b4200(0000) GS:ffff8b803ecc0000(0000) k= nlGS:0000000000000000 >> > [ 20.263202] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 >> > [ 20.263204] CR2: ffffb2b582cc2000 CR3: 00000003b6731000 CR4: 000000= 00003406e0 >> >=20 >> > I bisected this to 82fef0ad811f "x86/mm: unencrypted non-blocking DMA=20 >> > allocations use coherent pools". Reverting 1ee18de92927 resolves the=20 >> > issue. >> >=20 >> > Looks like Thinkpad X60 doesn't have VT-d, but could still be DMA=20 >> > related. >>=20 >> Note that newer -next releases seem to behave okay for me. The commit >> pointed out by siection is really simple: >>=20 >> AFAIK you could verify it is responsible by turning off >> CONFIG_AMD_MEM_ENCRYPT on latest kernel... >>=20 >> Best regards, >> Pavel >>=20 >> index 1d6104ea8af0..2bf2222819d3 100644 >> --- a/arch/x86/Kconfig >> +++ b/arch/x86/Kconfig >> @@ -1520,6 +1520,7 @@ config X86_CPA_STATISTICS >> config AMD_MEM_ENCRYPT >> bool "AMD Secure Memory Encryption (SME) support" >> depends on X86_64 && CPU_SUP_AMD >> + select DMA_COHERENT_POOL >> select DYNAMIC_PHYSICAL_MASK >> select ARCH_USE_MEMREMAP_PROT >> select ARCH_HAS_FORCE_DMA_UNENCRYPTED >=20 > Thanks for the report! >=20 > Besides CONFIG_AMD_MEM_ENCRYPT, do you have CONFIG_DMA_DIRECT_REMAP=20 > enabled? If so, it may be caused by the virtual address passed to the=20 > set_memory_{decrypted,encrypted}() functions. >=20 > And I assume you are enabling SME by using mem_encrypt=3Don on the kernel= =20 > command line or CONFIG_AMD_MEM_ENCRYPT_ACTIVE_BY_DEFAULT is enabled. >=20 > We likely need an atomic pool for devices that support DMA to addresses i= n=20 > sme_me_mask as well. I can test this tomorrow, but wanted to get it out=20 > early to see if it helps? This patch doesn't seem to help. I have the same problem (kernel page=20 fault, __memset, snd_pcm_hw_params...). I don't have CONFIG_DMA_DIRECT_REMAP enabled, and AFAICT it doesn't seem=20 to be selectable currently on x86, unless there are some patches=20 floating around for that.