From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18B4DC47083 for ; Mon, 31 May 2021 15:00:52 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D283A6128A for ; Mon, 31 May 2021 15:00:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D283A6128A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6C93A6E4D0; Mon, 31 May 2021 15:00:51 +0000 (UTC) Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by gabe.freedesktop.org (Postfix) with ESMTPS id 69BC96E4D0 for ; Mon, 31 May 2021 15:00:49 +0000 (UTC) Received: by mail-io1-xd29.google.com with SMTP id z24so12217829ioi.3 for ; Mon, 31 May 2021 08:00:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=wYKtm4IVSfVTnhnKghH2jNnLIsKH6Y+eNOaILu7ARSY=; b=AqMEgYi53g30HYY0imJtzNViu05fOgAo/xQtrrm9XrM3n3KYgdCy6sM36TaTmgv0v6 XvIYBkRFfNiS9tcDp32kkkQRj9L5R+h86b+EJM1hUjC5ImiLdtusiOsddmyVTjrm3mI6 HVyluqo0OJwH1PN9FVBpuFPsEkrQe6YRuMK7k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=wYKtm4IVSfVTnhnKghH2jNnLIsKH6Y+eNOaILu7ARSY=; b=fZH7T03DY4d/QIlW4TUyKYoU3DwRL1sVOyFW4nNylQNOVQunc/jlyz9bI8GgGrB1Po GpV85KRvWy1yRQ1SoMecBCVy+kvkcm8qBMSf5zCFHZzd7+e1Mkycp6xJxKqBlUr1KMkK M/LIG4DpS+R4odQEMq/zBOSjif97oz8V5x3x36HMAjogPij0zFZoTwJhTqO8tpSpC9BC LL78GlqFis5FKHSyzBNaKYOiPyWsWxwKRNN0td6RpY1U3/Z2F/QuubFu9+dJMwNn3nmL kFpTleVfkDtECrH0H0IMUgAVVE2a72lL0xh3xmZFH9hwPtpW4adHModcTZo7F1zRarnR nLwA== X-Gm-Message-State: AOAM5321++L7mCxj6aCc1n8PbQvWw3VfMi0/SDRfa3G3uVQKKfvq3jz8 6VoFRCyGKKZzSyT3wO5S1Mn2mubsf7vmfg== X-Google-Smtp-Source: ABdhPJzrQspmSdhpY0yBvHGbiOOZs8ia2SiDu6mgvUueDV1Z+/f/ZeroiCdjmbHMazC9AsmcB06uKw== X-Received: by 2002:a02:7348:: with SMTP id a8mr20952956jae.116.1622473248665; Mon, 31 May 2021 08:00:48 -0700 (PDT) Received: from mail-io1-f53.google.com (mail-io1-f53.google.com. [209.85.166.53]) by smtp.gmail.com with ESMTPSA id q6sm5810279ilm.45.2021.05.31.08.00.48 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 31 May 2021 08:00:48 -0700 (PDT) Received: by mail-io1-f53.google.com with SMTP id b25so12219836iot.5 for ; Mon, 31 May 2021 08:00:48 -0700 (PDT) X-Received: by 2002:a6b:690c:: with SMTP id e12mr17489820ioc.69.1622473237437; Mon, 31 May 2021 08:00:37 -0700 (PDT) MIME-Version: 1.0 References: <20210518064215.2856977-1-tientzu@chromium.org> <20210518064215.2856977-2-tientzu@chromium.org> <170a54f2-be20-ec29-1d7f-3388e5f928c6@gmail.com> <20210527130211.GA24344@lst.de> In-Reply-To: From: Claire Chang Date: Mon, 31 May 2021 23:00:26 +0800 X-Gmail-Original-Message-ID: Message-ID: To: Tom Lendacky Subject: Re: [Intel-gfx] [PATCH v7 01/15] swiotlb: Refactor swiotlb init functions X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: heikki.krogerus@linux.intel.com, thomas.hellstrom@linux.intel.com, peterz@infradead.org, benh@kernel.crashing.org, dri-devel@lists.freedesktop.org, chris@chris-wilson.co.uk, grant.likely@arm.com, paulus@samba.org, Frank Rowand , mingo@kernel.org, Marek Szyprowski , Florian Fainelli , Saravana Kannan , mpe@ellerman.id.au, Joerg Roedel , "Rafael J . Wysocki" , Christoph Hellwig , Bartosz Golaszewski , bskeggs@redhat.com, linux-pci@vger.kernel.org, xen-devel@lists.xenproject.org, Thierry Reding , intel-gfx@lists.freedesktop.org, matthew.auld@intel.com, linux-devicetree , Jianxiong Gao , Will Deacon , Konrad Rzeszutek Wilk , airlied@linux.ie, Dan Williams , linuxppc-dev@lists.ozlabs.org, Rob Herring , Bjorn Helgaas , boris.ostrovsky@oracle.com, Andy Shevchenko , jgross@suse.com, Nicolas Boichat , Greg KH , Randy Dunlap , lkml , Tomasz Figa , "list@263.net:IOMMU DRIVERS" , sstabellini@kernel.org, Jim Quinlan , xypron.glpk@gmx.de, Robin Murphy , bauerman@linux.ibm.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Fri, May 28, 2021 at 12:32 AM Tom Lendacky wrote: > > On 5/27/21 9:41 AM, Tom Lendacky wrote: > > On 5/27/21 8:02 AM, Christoph Hellwig wrote: > >> On Wed, May 19, 2021 at 11:50:07AM -0700, Florian Fainelli wrote: > >>> You convert this call site with swiotlb_init_io_tlb_mem() which did not > >>> do the set_memory_decrypted()+memset(). Is this okay or should > >>> swiotlb_init_io_tlb_mem() add an additional argument to do this > >>> conditionally? > >> > >> The zeroing is useful and was missing before. I think having a clean > >> state here is the right thing. > >> > >> Not sure about the set_memory_decrypted, swiotlb_update_mem_attributes > >> kinda suggests it is too early to set the memory decrupted. > >> > >> Adding Tom who should now about all this. > > > > The reason for adding swiotlb_update_mem_attributes() was because having > > the call to set_memory_decrypted() in swiotlb_init_with_tbl() triggered a > > BUG_ON() related to interrupts not being enabled yet during boot. So that > > call had to be delayed until interrupts were enabled. > > I pulled down and tested the patch set and booted with SME enabled. The > following was seen during the boot: > > [ 0.134184] BUG: Bad page state in process swapper pfn:108002 > [ 0.134196] page:(____ptrval____) refcount:0 mapcount:-128 mapping:0000000000000000 index:0x0 pfn:0x108002 > [ 0.134201] flags: 0x17ffffc0000000(node=0|zone=2|lastcpupid=0x1fffff) > [ 0.134208] raw: 0017ffffc0000000 ffff88847f355e28 ffff88847f355e28 0000000000000000 > [ 0.134210] raw: 0000000000000000 0000000000000001 00000000ffffff7f 0000000000000000 > [ 0.134212] page dumped because: nonzero mapcount > [ 0.134213] Modules linked in: > [ 0.134218] CPU: 0 PID: 0 Comm: swapper Not tainted 5.13.0-rc2-sos-custom #3 > [ 0.134221] Hardware name: ... > [ 0.134224] Call Trace: > [ 0.134233] dump_stack+0x76/0x94 > [ 0.134244] bad_page+0xa6/0xf0 > [ 0.134252] __free_pages_ok+0x331/0x360 > [ 0.134256] memblock_free_all+0x158/0x1c1 > [ 0.134267] mem_init+0x1f/0x14c > [ 0.134273] start_kernel+0x290/0x574 > [ 0.134279] secondary_startup_64_no_verify+0xb0/0xbb > > I see this about 40 times during the boot, each with a different PFN. The > system boots (which seemed odd), but I don't know if there will be side > effects to this (I didn't stress the system). > > I modified the code to add a flag to not do the set_memory_decrypted(), as > suggested by Florian, when invoked from swiotlb_init_with_tbl(), and that > eliminated the bad page state BUG. Thanks. Will add a flag to skip set_memory_decrypted() in v9. > > Thanks, > Tom > > > > > Thanks, > > Tom > > > >> _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx