Re: [bug] __blk_mq_run_hw_queue suspicious rcu usage

2019-09-17 Thread Lendacky, Thomas
On 9/17/19 1:23 PM, David Rientjes wrote: > On Mon, 16 Sep 2019, David Rientjes wrote: > >> Brijesh and Tom, we currently hit this any time we boot an SEV enabled >> Ubuntu 18.04 guest; I assume that guest kernels, especially those of such >> major distributions, are expected to work with

Re: [PATCH 3/3] iommu: Disable passthrough mode when SME is active

2019-08-09 Thread Lendacky, Thomas
On 8/9/19 10:22 AM, Joerg Roedel wrote: > From: Joerg Roedel > > Using Passthrough mode when SME is active causes certain > devices to use the SWIOTLB bounce buffer. The bounce buffer > code has an upper limit of 256kb for the size of DMA > allocations, which is too small for certain devices and

Re: Regression due to d98849aff879 (dma-direct: handle DMA_ATTR_NO_KERNEL_MAPPING in common code)

2019-08-06 Thread Lendacky, Thomas
On 8/6/19 10:46 AM, Christoph Hellwig wrote: > On Tue, Aug 06, 2019 at 02:18:49PM +0000, Lendacky, Thomas wrote: >> I think you need to keep everything inside the original if statement since >> the caller is expecting a page pointer to be returned in this case and not >> the

Re: Regression due to d98849aff879 (dma-direct: handle DMA_ATTR_NO_KERNEL_MAPPING in common code)

2019-08-06 Thread Lendacky, Thomas
On 8/6/19 9:06 AM, Lucas Stach wrote: > Am Dienstag, den 06.08.2019, 16:04 +0200 schrieb Christoph Hellwig: >> Ok, does this work? >> >> -- >> From 34d35f335a98f515f2516b515051e12eae744c8d Mon Sep 17 00:00:00 2001 >>> From: Christoph Hellwig >> Date: Tue, 6 Aug 2019 14:33:23 +0300 >> Subject:

Re: Regression due to d98849aff879 (dma-direct: handle DMA_ATTR_NO_KERNEL_MAPPING in common code)

2019-08-06 Thread Lendacky, Thomas
On 8/6/19 6:33 AM, Christoph Hellwig wrote: > On Tue, Aug 06, 2019 at 11:13:29AM +0200, Lucas Stach wrote: >> Hi Christoph, >> >> I just found a regression where my NVMe device is no longer able to set >> up its HMB. >> >> After subject commit dma_direct_alloc_pages() is no longer initializing >>

Re: [PATCH] dma-direct: Force unencrypted DMA under SME for certain DMA masks

2019-07-24 Thread Lendacky, Thomas
On 7/24/19 1:40 PM, Kirill A. Shutemov wrote: > On Wed, Jul 24, 2019 at 06:30:21PM +0000, Lendacky, Thomas wrote: >> On 7/24/19 1:11 PM, Kirill A. Shutemov wrote: >>> On Wed, Jul 24, 2019 at 05:34:26PM +, Lendacky, Thomas wrote: >>>> On 7/24/19 12:06 PM, Robin Mur

Re: [PATCH] dma-direct: Force unencrypted DMA under SME for certain DMA masks

2019-07-24 Thread Lendacky, Thomas
On 7/24/19 1:11 PM, Kirill A. Shutemov wrote: > On Wed, Jul 24, 2019 at 05:34:26PM +0000, Lendacky, Thomas wrote: >> On 7/24/19 12:06 PM, Robin Murphy wrote: >>> On 24/07/2019 17:42, Lendacky, Thomas wrote: >>>> On 7/24/19 10:55 AM, Kirill A. Shutemov wrote: >&

Re: [PATCH] dma-direct: Force unencrypted DMA under SME for certain DMA masks

2019-07-24 Thread Lendacky, Thomas
On 7/24/19 12:06 PM, Robin Murphy wrote: > On 24/07/2019 17:42, Lendacky, Thomas wrote: >> On 7/24/19 10:55 AM, Kirill A. Shutemov wrote: >>> On Wed, Jul 10, 2019 at 07:01:19PM +, Lendacky, Thomas wrote: >>>> @@ -351,6 +355,32 @@ bool sev_active(void) >>&g

Re: [PATCH] dma-direct: Force unencrypted DMA under SME for certain DMA masks

2019-07-24 Thread Lendacky, Thomas
On 7/24/19 10:55 AM, Kirill A. Shutemov wrote: > On Wed, Jul 10, 2019 at 07:01:19PM +0000, Lendacky, Thomas wrote: >> @@ -351,6 +355,32 @@ bool sev_active(void) >> } >> EXPORT_SYMBOL(sev_active); >> >> +/* Override for DMA direct allocation check -

Re: [PATCH v3 0/6] Remove x86-specific code from generic headers

2019-07-19 Thread Lendacky, Thomas
On 7/18/19 2:44 PM, Thiago Jung Bauermann wrote: > > Lendacky, Thomas writes: > >> On 7/17/19 10:28 PM, Thiago Jung Bauermann wrote: >>> Hello, >>> >>> This version is mostly about splitting up patch 2/3 into three separate >>> patches, a

Re: [PATCH v3 0/6] Remove x86-specific code from generic headers

2019-07-18 Thread Lendacky, Thomas
On 7/17/19 10:28 PM, Thiago Jung Bauermann wrote: > Hello, > > This version is mostly about splitting up patch 2/3 into three separate > patches, as suggested by Christoph Hellwig. Two other changes are a fix in > patch 1 which wasn't selecting ARCH_HAS_MEM_ENCRYPT for s390 spotted by > Janani

Re: [PATCH v3 5/6] fs/core/vmcore: Move sev_active() reference to x86 arch code

2019-07-18 Thread Lendacky, Thomas
On 7/17/19 10:28 PM, Thiago Jung Bauermann wrote: > Secure Encrypted Virtualization is an x86-specific feature, so it shouldn't > appear in generic kernel code because it forces non-x86 architectures to > define the sev_active() function, which doesn't make a lot of sense. > > To solve this

Re: [PATCH v3 4/6] x86, s390/mm: Move sme_active() and sme_me_mask to x86-specific header

2019-07-18 Thread Lendacky, Thomas
On 7/17/19 10:28 PM, Thiago Jung Bauermann wrote: > Now that generic code doesn't reference them, move sme_active() and > sme_me_mask to x86's . > > Also remove the export for sme_active() since it's only used in files that > won't be built as modules. sme_me_mask on the other hand is used in >

Re: [PATCH v3 3/6] dma-mapping: Remove dma_check_mask()

2019-07-18 Thread Lendacky, Thomas
On 7/17/19 10:28 PM, Thiago Jung Bauermann wrote: > sme_active() is an x86-specific function so it's better not to call it from > generic code. Christoph Hellwig mentioned that "There is no reason why we > should have a special debug printk just for one specific reason why there > is a requirement

Re: [PATCH v3 2/6] swiotlb: Remove call to sme_active()

2019-07-18 Thread Lendacky, Thomas
On 7/17/19 10:28 PM, Thiago Jung Bauermann wrote: > sme_active() is an x86-specific function so it's better not to call it from > generic code. > > There's no need to mention which memory encryption feature is active, so > just use a more generic message. Besides, other architectures will have >

Re: x86-64 kernel dma issue; bisected

2019-07-18 Thread Lendacky, Thomas
On 7/18/19 4:31 AM, Christoph Hellwig wrote: > On Tue, Jul 16, 2019 at 10:43:33PM -0400, Al Farleigh wrote: >> re: the dma-direct code commit below >> >> I have bisected the kernel to isolate a PCI board problem on my AMD x86-64 >> ASROCK system. The board worked at (Fedora kernel) 4.18.16 but

Re: [PATCH 3/3] fs/core/vmcore: Move sev_active() reference to x86 arch code

2019-07-15 Thread Lendacky, Thomas
On 7/15/19 9:30 AM, Christoph Hellwig wrote: > On Mon, Jul 15, 2019 at 04:03:17PM +0200, Halil Pasic wrote: >>> I thought about that but couldn't put my finger on a general concept. >>> Is it "guest with memory inaccessible to the host"? >>> >> >> Well, force_dma_unencrypted() is a much better

[PATCH] dma-direct: Force unencrypted DMA under SME for certain DMA masks

2019-07-10 Thread Lendacky, Thomas
From: Tom Lendacky If a device doesn't support DMA to a physical address that includes the encryption bit (currently bit 47, so 48-bit DMA), then the DMA must occur to unencrypted memory. SWIOTLB is used to satisfy that requirement if an IOMMU is not active (enabled or configured in passthrough

Re: [PATCH 0/5 v5] Fix virtio-blk issue with SWIOTLB

2019-01-30 Thread Lendacky, Thomas
On 1/30/19 10:40 AM, Joerg Roedel wrote: > Hi, > > here is the next version of this patch-set. Previous > versions can be found here: > > V1: https://lore.kernel.org/lkml/20190110134433.15672-1-j...@8bytes.org/ > > V2:

Re: [PATCH 4/5] virtio: Introduce virtio_max_dma_size()

2019-01-30 Thread Lendacky, Thomas
On 1/29/19 2:43 AM, Joerg Roedel wrote: > From: Joerg Roedel > > This function returns the maximum segment size for a single > dma transaction of a virtio device. The possible limit comes > from the SWIOTLB implementation in the Linux kernel, that > has an upper limit of (currently) 256kb of

Re: [PATCH 2/2] x86/kvmclock: set_memory_decrypted() takes number of pages

2019-01-22 Thread Lendacky, Thomas
On 1/22/19 3:17 PM, Thiago Jung Bauermann wrote: > From: Ram Pai > > set_memory_decrypted() expects the number of PAGE_SIZE pages to decrypt. > kvmclock_init_mem() instead passes number of bytes. This decrypts a huge > number of pages resulting in data corruption. Same comment as patch 1/2 in

Re: [PATCH 1/2] dma-direct: set_memory_{en,de}crypted() take number of pages

2019-01-22 Thread Lendacky, Thomas
On 1/22/19 3:17 PM, Thiago Jung Bauermann wrote: > From: Ram Pai > > set_memory_encrypted() and set_memory_decrypted() expect the number of > PAGE_SIZE pages to encrypt or decrypt. dma_direct_alloc() and > dma_direct_free() instead pass number of bytes. This encrypts/decrypts a > huge number of

Re: [PATCH] kernel/dma/direct: Do not include SME mask in the DMA supported check

2018-12-17 Thread Lendacky, Thomas
On 12/16/2018 05:41 PM, Tom Lendacky wrote: > On 12/15/2018 04:55 AM, Christoph Hellwig wrote: >> The mail seems to be so oddly encoded so that git-am fails on it. Can >> you resend as plain text? > > Hmmm... not sure what happened with that, but yeah, looking at the message > source shows

[RESEND PATCH] kernel/dma/direct: Do not include SME mask in the DMA supported check

2018-12-17 Thread Lendacky, Thomas
The dma_direct_supported() function intends to check the DMA mask against specific values. However, the phys_to_dma() function includes the SME encryption mask, which defeats the intended purpose of the check. This results in drivers that support less than 48-bit DMA (SME encryption mask is bit

Re: [PATCH] kernel/dma/direct: Do not include SME mask in the DMA supported check

2018-12-16 Thread Lendacky, Thomas
On 12/15/2018 04:55 AM, Christoph Hellwig wrote: > The mail seems to be so oddly encoded so that git-am fails on it. Can > you resend as plain text? Hmmm... not sure what happened with that, but yeah, looking at the message source shows something strange went on. Let me take a look and I'll try

[PATCH] kernel/dma/direct: Do not include SME mask in the DMA supported check

2018-12-13 Thread Lendacky, Thomas
The dma_direct_supported() function intends to check the DMA mask against specific values. However, the phys_to_dma() function includes the SME encryption mask, which defeats the intended purpose of the check. This results in drivers that support less than 48-bit DMA (SME encryption mask is bit

Re: [PATCH] dma-direct: Fix return value of dma_direct_supported

2018-12-13 Thread Lendacky, Thomas
On 10/04/2018 10:13 AM, Alexander Duyck wrote: > On Thu, Oct 4, 2018 at 4:25 AM Robin Murphy wrote: >> >> On 04/10/18 00:48, Alexander Duyck wrote: >>> It appears that in commit 9d7a224b463e ("dma-direct: always allow dma mask >>> <= physiscal memory size") the logic of the test was changed from

Re: [PATCH 0/4 v7] Support kdump for AMD secure memory encryption(SME)

2018-09-25 Thread Lendacky, Thomas
On 09/07/2018 03:18 AM, Lianbo Jiang wrote: > When SME is enabled on AMD machine, we also need to support kdump. Because > the memory is encrypted in the first kernel, we will remap the old memory > to the kdump kernel for dumping data, and SME is also enabled in the kdump > kernel, otherwise the