Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3752093pxb; Tue, 26 Jan 2021 03:58:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJxob4w6nhNBB+BtVMj401rZ72XM6LFEglaAqGhQlTHwmwoG8swIlA20kJDb37e7zpJ0wX4Y X-Received: by 2002:a17:906:154d:: with SMTP id c13mr3313982ejd.471.1611662338453; Tue, 26 Jan 2021 03:58:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611662338; cv=none; d=google.com; s=arc-20160816; b=p/q6xIjzZujItpm43qQig8wJo0iF6SocTzFBHLeij3RSooUAKOdLREAVws2pOkMzBI BSarHZXR/7MpYz7m631PHWMLcdVQa3xdoqBL9LXJy3sm4PH2iSxwByJms+gIGFnxaeeh nLSi46GSwPW+LF+H6BrdsveXNJvCzZ3fQD8nB6rse2Ol+XZKyspibGlx00JZUtfX+zRM it9K1EAqG8ONjchqLKjq5nrKH7C82OVg+ovckaDiFgot0bFP8kB3tbe8mO2KWFq+yOY1 Z/K+gwTHecelof88P7ZExWXToTLFZumjuhow1the3yV3+FAqyu0wZnwzLZ3QKMNWXyLX thzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=tf6SOP1+uSuFzlR74PmLs+Qb9Jg6cZLWh14S6+CIZes=; b=bToKys6lCKVaXMuv+vMMreIXw4y/sB79N0uNVe4Jf7fJ9/Kfpm9uyDaAmhW2KGhSGK dtXbcTfEMt16XDRg0uRso9jZLfOOWZAm1r33LlYJxX3rbdK0MeyiyTub6FgDaLfaPcHm Jrp4Of37E1SJoxP7Cb74sVwlTUChZymTktys37TFAgAOt4KCXIrChxI0uLKBCk4ySlX7 6nXgu9cmIpd+IUPKAbasiQxtYwAWPbnb2zVy0anezkMWoeY4ENPTb0H1oSMAj/TFF+71 6hAA3vno8jGCDW/M3pLbcByjn+jmlyopzEQ5XnNXEpxwA+dnmKwPxabp212wWdKcHSUB 5oSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=MhkV411I; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v24si9340009eda.271.2021.01.26.03.58.34; Tue, 26 Jan 2021 03:58:58 -0800 (PST) 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=@redhat.com header.s=mimecast20190719 header.b=MhkV411I; 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=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392593AbhAZLzX (ORCPT + 99 others); Tue, 26 Jan 2021 06:55:23 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:37967 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2392571AbhAZLzN (ORCPT ); Tue, 26 Jan 2021 06:55:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611662027; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=tf6SOP1+uSuFzlR74PmLs+Qb9Jg6cZLWh14S6+CIZes=; b=MhkV411IRAlYwWWABWXrSaKKYvTCqAsKHZjXfEB7WWPrWljBWI4AFJhu4VES4w5UxHZCCQ eWlM9XvZyTjpkRbGGGZ0plB/N7q8q5jaTpVk8dpgYpoOdhUWli5cIDaEgFkBDUoUcYZoZV mds9aMP5+whLl9ktPQDB2u9U7bwjsrA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-57-GJ2V3kJMNZOg9DuCyXGLxQ-1; Tue, 26 Jan 2021 06:53:46 -0500 X-MC-Unique: GJ2V3kJMNZOg9DuCyXGLxQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A71C5180A096; Tue, 26 Jan 2021 11:53:44 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-12-72.pek2.redhat.com [10.72.12.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7095710016F7; Tue, 26 Jan 2021 11:53:40 +0000 (UTC) From: Lianbo Jiang To: linux-kernel@vger.kernel.org Cc: joro@8bytes.org, will@kernel.org, iommu@lists.linux-foundation.org, jsnitsel@redhat.com, thomas.lendacky@amd.com, robin.murphy@arm.com, bhe@redhat.com, hch@infradead.org, baolu.lu@linux.intel.com Subject: [PATCH v3 0/2] iommu: fix the failure of deferred attach for iommu attach device Date: Tue, 26 Jan 2021 19:53:35 +0800 Message-Id: <20210126115337.20068-1-lijiang@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset is to fix the failure of deferred attach for iommu attach device, it includes the following two patches: [1] [PATCH 1/2] dma-iommu: use static-key to minimize the impact in the fast-path This is a prepared patch for the second one, move out the is_kdump_kernel() check from iommu_dma_deferred_attach() to iommu_dma_init(), and use the static-key in the fast-path to minimize the impact in the normal case. [2] [PATCH 2/2] iommu: use the __iommu_attach_device() directly for deferred attach Move the handling currently in iommu_dma_deferred_attach() into the iommu core code so that it can call the __iommu_attach_device() directly instead of the iommu_attach_device(). The external interface iommu_attach_device() is not suitable for handling this situation. Changes since v1: [1] use the __iommu_attach_device() directly for deferred attach [2] use static-key to minimize the impact in the fast-path Changes since v2: [1] remove the underscores for the variable "__deferred_attach", and change its name to iommu_deferred_attach_enabled [Suggested by Christoph Hellwig] [2] remove the "do_" from the iommu_do_deferred_attach(), and change its name to iommu_deferred_attach() [3] remove the "extern" from the definition of iommu_deferred_attach() in include/linux/iommu.h Lianbo Jiang (2): dma-iommu: use static-key to minimize the impact in the fast-path iommu: use the __iommu_attach_device() directly for deferred attach drivers/iommu/dma-iommu.c | 29 +++++++++++------------------ drivers/iommu/iommu.c | 10 ++++++++++ include/linux/iommu.h | 1 + 3 files changed, 22 insertions(+), 18 deletions(-) -- 2.17.1