Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2268301pxj; Sun, 16 May 2021 20:40:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzylD64BUKyhb6XYdAYjwcepASlkm6PbvUVut+Q0uzVYp/Y/rmY72hO7E0V1QEuItJajM7y X-Received: by 2002:a05:6402:51d3:: with SMTP id r19mr68443708edd.360.1621222845085; Sun, 16 May 2021 20:40:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621222845; cv=none; d=google.com; s=arc-20160816; b=IlYZnrgRBgkRpEBJB0w5TADOJ6+AfdOD1nxdksMPiX7SAxWF2KjOXa49WxnQTbmRsY 5ZZ7hXBPRBGwl+HN7tDyQJvulY8T2i2vndYW/rER2t4Cm2fn+6JCoxNimFBCx2TvldIu UGXK+a1Zc42IKMcHI7UY+53vwdGkJfRS9Z2NOATrVV+YM5YvftmaMdKN6SgxsJ+D0FrB Vk9ml3JOz+jXdRiFrW/wmudYOTmFceVOJ4KXy8EHEIMK43IdTTq3K/ilMpsVxf/0qbkr q7NBVCFYKKvrSSZWK1bKJe8W1TEUbDURETss/F9sSp/wAZqBYnqbWpsMCMtdbYEWfrtU bHFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject:cc:ironport-sdr:ironport-sdr; bh=J70PxYDEwnHDfNcgvEM0CtgvgZvtXEYa6u9fVkTX04o=; b=nG+0xLwhnyGuDIlc0WtEhdCGiIdAm8Xo0txPRWE6GEJ7vOrEEyFXCi8f2fjNoPh6TH +Zqa3hZGLAAwjsXZ6E10x8WiUqq8yIeX9aOLkSi7QijbeqsmzHYEPZiy/3Rg8dpw9zs3 xL+DC+0SdcmyPACum5rK/oPblKTeTSW6Qi0i0KZ73hf42y+dpkPOWt1gGpEZGwfDZcAH mxq1PzyenxYYtK3x4rTkU/JPBZymx+u4IJTghI+BzHYSmFi8KcVB9rzpbeTwVJLfLGv2 TI39Tp4JPZUhTQjJ+iGiFKFtG/1uWFif3sfjuMA8+vEHSejfr457SybJRRSXQ3BLYk53 Xu9Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k25si7122819ejg.471.2021.05.16.20.40.22; Sun, 16 May 2021 20:40:45 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233749AbhEQCkx (ORCPT + 99 others); Sun, 16 May 2021 22:40:53 -0400 Received: from mga02.intel.com ([134.134.136.20]:34015 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233524AbhEQCkw (ORCPT ); Sun, 16 May 2021 22:40:52 -0400 IronPort-SDR: m1N9fxitMZAxCQQVig5l420jkQSoCAmA2DcNmuzOq7iaw7KbHlMUbKN6A2Zu+6fjievAUNXKqL gJJIss17ixTg== X-IronPort-AV: E=McAfee;i="6200,9189,9986"; a="187495306" X-IronPort-AV: E=Sophos;i="5.82,306,1613462400"; d="scan'208";a="187495306" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 May 2021 19:39:36 -0700 IronPort-SDR: AZemN1N+C9Rz0wCLcGxfq2qNnmL2gA/lD5poLSS9/b7+cIqc846WgRqzFxixF3dqotq2JGhpJw Li+Tp5ttk4/A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.82,306,1613462400"; d="scan'208";a="626267587" Received: from allen-box.sh.intel.com (HELO [10.239.159.128]) ([10.239.159.128]) by fmsmga006.fm.intel.com with ESMTP; 16 May 2021 19:39:34 -0700 Cc: baolu.lu@linux.intel.com, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Ashok Raj , Joerg Roedel , Sasha Levin Subject: Re: [PATCH 5.10 392/530] iommu/vt-d: Preset Access/Dirty bits for IOVA over FL To: =?UTF-8?Q?Wolfgang_M=c3=bcller?= , Greg Kroah-Hartman References: <20210512144819.664462530@linuxfoundation.org> <20210512144832.660153884@linuxfoundation.org> <20210515132855.4bn7ve2ozvdhpnj4@nabokov.fritz.box> From: Lu Baolu Message-ID: <5d9b2c1a-f2f4-a9db-a14b-b6a31da59f54@linux.intel.com> Date: Mon, 17 May 2021 10:38:42 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210515132855.4bn7ve2ozvdhpnj4@nabokov.fritz.box> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Wolfgang, On 5/15/21 9:28 PM, Wolfgang Müller wrote: > Hi! > > First of all, apologies if this is the wrong place to post a problem > report. I figured since I was going to reference a particular commit > anyway I might as well reply to the patch series that (seemed to have) > introduced the problem. > >> From: Lu Baolu >> >> [ Upstream commit a8ce9ebbecdfda3322bbcece6b3b25888217f8e3 ] >> >> The Access/Dirty bits in the first level page table entry will be set >> whenever a page table entry was used for address translation or write >> permission was successfully translated. This is always true when using >> the first-level page table for kernel IOVA. Instead of wasting hardware >> cycles to update the certain bits, it's better to set them up at the >> beginning. > > This commit seems to trigger a kernel panic very early in boot for me in > 5.10.37 (36 is fine): It seems due to the back-ported patch: - if (!sg) { - sg_res = nr_pages; - pteval = ((phys_addr_t)phys_pfn << VTD_PAGE_SHIFT) | attr; + if (domain->domain.type == IOMMU_DOMAIN_DMA) { + attr |= DMA_FL_PTE_ACCESS; + if (prot & DMA_PTE_WRITE) + attr |= DMA_FL_PTE_DIRTY; + } } + pteval = ((phys_addr_t)phys_pfn << VTD_PAGE_SHIFT) | attr; Greg, do you want me to rework this patch, or submit an incremental fix? Best regards, baolu