Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp882168ybz; Fri, 17 Apr 2020 11:44:13 -0700 (PDT) X-Google-Smtp-Source: APiQypJTGSLe3+0DA7s9Sj1LsMb8W5TAab828GTSRfsXi35ivagJAsnT8aTA6+s598pLiNFuutwg X-Received: by 2002:a17:906:24c2:: with SMTP id f2mr4473658ejb.285.1587149052959; Fri, 17 Apr 2020 11:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587149052; cv=none; d=google.com; s=arc-20160816; b=i1JeNJgdh/c6TUBw+UvBvZWNJhmHv6PLRF2kTEDQsMZCJG0yLu8Pr9OupI3PrCFIeT b4WDespJNkt03t+ypM7nULIieloyxPkxyF7RfEI1vYardn39SrGZqosuLb91Itvv8owR hCEHfeZyP4xEGwfvoCNAtxI3QDkh4M53UyGBKN9Od+P4KmK3YDJiS1RffS5U+SDOztQ6 RF1DT/tG5NXildzo1GXqDO/N/yJ11eTMpQyWnQbtOHYpmnMueRVKEJRiMnmRdBnBpZGw UEB8A793DguZRseAXy/vBO/fN2FPXP/6IoQVE6GeQxXK/Ay+l1G7usmMmcZ56yAGu1es qDhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=Ju33b1g72uTAJNdx7tvrGrx42I2+s4vgy+9DTyNsRdk=; b=IYWFIjwjO9YdY7geUz9ipQtQYYeec6nk2mOfcQbzdINnb56XvS4zuoAP8tJ6FjXXiM T6hbJ+9OIkiO4G/V8cJJungizP/5ydU81HwI+9kJoxi00JYroe0APGShl9jNr3J5WZ3S R8lRDZpRVZbJOKnIaNl4UeJN6h+8tKlEly95dIHdtAoXcHVo55wI75gHDgnqKmHQerus 87Gx+8ttOL0FO71+gvqfz8PIvlx3obY318tcIDx0CK+KEPGEDmcS3b79cnWuEwRFn/IP I7n3r/1A3BHlctVo8saX+JsR2dMKHj79ViPCJZ5sSxaxxmwS1opRYCvkMBIjWtVx6fFb Hmvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=MgTq2g0+; 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=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h10si13270628ejb.380.2020.04.17.11.43.49; Fri, 17 Apr 2020 11:44:12 -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=@google.com header.s=20161025 header.b=MgTq2g0+; 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=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729551AbgDQSmC (ORCPT + 99 others); Fri, 17 Apr 2020 14:42:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728801AbgDQSmB (ORCPT ); Fri, 17 Apr 2020 14:42:01 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 530F5C061A0C for ; Fri, 17 Apr 2020 11:42:01 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id r14so1473667pfg.2 for ; Fri, 17 Apr 2020 11:42:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=Ju33b1g72uTAJNdx7tvrGrx42I2+s4vgy+9DTyNsRdk=; b=MgTq2g0+QPDr3oesAW/HHVoC/JjUZ5+d9D9oiJIWFpRrCiRXmAsGt/kZStXgTbeynL ++nCOqIEuGPy+qXVJ+KcY4od24xU5qFSu0YHHMysmyUrwotgVPo7MianqVterrTWUHoA XxuP6zhz0/YU7uK+0VBcevQLi1+hZE9TZgWDGteRTydfYVMV9xVNxZB7vf8Rt7+jf5z8 lixGSkyHF7OLMpEp8xlwO8DMqAnA5DGS4QoQFSwwrIzDTwZBkGK3X7wNKjkwRk+k/T0a yCUNAX/+DXzERd2LtBHKwzAz5O7f7ceX2sZK3pxoPxvUpyyxjGi9VjxPLKF/Fch5at/o e6+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=Ju33b1g72uTAJNdx7tvrGrx42I2+s4vgy+9DTyNsRdk=; b=HVdPk+ahBRfm3jiON6k10iS5U7LUmjks3fzRoqW55pxQHMj3k2wV5VLVdCFDMA3ZMU FQdwAH7hH3Z2BhbFz5A22T8lkoR97W5VIcn+8tSILLr0c8wu1huBYo+TUBpPe7QP/5Up +frT15bi0aSULj7Qs1x3imOwjlQCOjrHmUEyIABgRo+mKQFWUwCJuZk3HdjRgjuV+LO9 sJ3IBEjkEu8ht1KA2IMLKp6emX/qJtlq9i0WIk5kEMTfpQfeAdPbiR5Ley7NTt3pKgPb Rt8x1JRnOmW3ezyEFSp1PPmZbUi5fgzCYgHEsiGlaR2PadmbQAo1b5ZLEvFG67Yhm1bH atkQ== X-Gm-Message-State: AGi0PubQbnIVqdTjwhwfrirN7QUNKmEzgjIp3ixpUq77X+n6Hqf+KU0A 0A5mFE8iv0Tn1FVFkRXvnecQsw== X-Received: by 2002:a62:2b05:: with SMTP id r5mr4240532pfr.120.1587148920663; Fri, 17 Apr 2020 11:42:00 -0700 (PDT) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id i10sm6730303pfa.166.2020.04.17.11.41.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Apr 2020 11:41:59 -0700 (PDT) Date: Fri, 17 Apr 2020 11:41:59 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Christoph Hellwig cc: Tom Lendacky , Brijesh Singh , Jon Grimm , Joerg Roedel , linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org Subject: Re: [patch 0/7] unencrypted atomic DMA pools with dynamic expansion In-Reply-To: <20200417071112.GD19153@lst.de> Message-ID: References: <20200417071112.GD19153@lst.de> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 17 Apr 2020, Christoph Hellwig wrote: > So modulo a few comments that I can fix up myself this looks good. Unless > you want to resend for some reason I'm ready to pick this up once I open > the dma-mapping tree after -rc2. > Yes, please do, and thanks to both you and Thomas for the guidance and code reviews. Once these patches take on their final form in your branch, how supportive would you be of stable backports going back to 4.19 LTS? There have been several changes to this area over time, so there are varying levels of rework that need to be done for each stable kernel back to 4.19. But I'd be happy to do that work if you are receptive to it. For rationale, without these fixes, all SEV enabled guests warn of blocking in rcu read side critical sections when using drivers that allocate atomically though the DMA API that calls set_memory_decrypted(). Users can see warnings such as these in the guest: BUG: sleeping function called from invalid context at mm/vmalloc.c:1710 in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 3383, name: fio 2 locks held by fio/3383: #0: ffff93b6a8568348 (&sb->s_type->i_mutex_key#16){+.+.}, at: ext4_file_write_iter+0xa2/0x5d0 #1: ffffffffa52a61a0 (rcu_read_lock){....}, at: hctx_lock+0x1a/0xe0 CPU: 0 PID: 3383 Comm: fio Tainted: G W 5.5.10 #14 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: dump_stack+0x98/0xd5 ___might_sleep+0x175/0x260 __might_sleep+0x4a/0x80 _vm_unmap_aliases+0x45/0x250 vm_unmap_aliases+0x19/0x20 __set_memory_enc_dec+0xa4/0x130 set_memory_decrypted+0x10/0x20 dma_direct_alloc_pages+0x148/0x150 dma_direct_alloc+0xe/0x10 dma_alloc_attrs+0x86/0xc0 dma_pool_alloc+0x16f/0x2b0 nvme_queue_rq+0x878/0xc30 [nvme] __blk_mq_try_issue_directly+0x135/0x200 blk_mq_request_issue_directly+0x4f/0x80 blk_mq_try_issue_list_directly+0x46/0xb0 blk_mq_sched_insert_requests+0x19b/0x2b0 blk_mq_flush_plug_list+0x22f/0x3b0 blk_flush_plug_list+0xd1/0x100 blk_finish_plug+0x2c/0x40 iomap_dio_rw+0x427/0x490 ext4_file_write_iter+0x181/0x5d0 aio_write+0x109/0x1b0 io_submit_one+0x7d0/0xfa0 __x64_sys_io_submit+0xa2/0x280 do_syscall_64+0x5f/0x250