Received: by 2002:a05:7412:2a8a:b0:fc:a2b0:25d7 with SMTP id u10csp427643rdh; Wed, 7 Feb 2024 08:41:34 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/kXngCCIYMAKjfpPar1udKjLt6M71KnvaUHxhDdOpLsjS9JxaSHt9JEYv5wMxeRqz5JXr X-Received: by 2002:a17:902:bd8b:b0:1d5:f36c:8737 with SMTP id q11-20020a170902bd8b00b001d5f36c8737mr4962643pls.68.1707324093758; Wed, 07 Feb 2024 08:41:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707324093; cv=pass; d=google.com; s=arc-20160816; b=ir3cUzLuXkGjF8IzWImtqmBtxNqsRaOAp2IYCdh+MH3S5MhWJhNPmJFiL35p8pV7+C frAjZdNJS9V4rkrR+Z//yz+gSf/Avp9z/fhMo0sL2Y2howwGc93jhOT2ojjLeJ23MMZ8 Q8VgXNTaGDvefzhb2OHcr0efeWXC2Nz6MEIsiI7HTeNzleYLzh54wsV6w9JVx2KVS0XJ 1DCIKoyKCRN2gcxwhpeGwJHbXuKGrdRjcUut/0g/M5o7WBG7WLKW3uGGYYkn7MHTHMq7 n7fKuhcpQCYDouJtgPyrDDb3nB65tz4PaFm58rnTjrKgjepVRg4bQrHfDPFYVLelg0sV v1fw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Q3J41sYakbr7nCpsD0r1AspXJMKiAGuYob6ug5klcDE=; fh=4hxq7GitMvz9el9aYVvO3f7r9oLLQs/pAh1K2WKX59k=; b=U+ZW07nHWjVb51gPxjOJudAphEm6qSEMKroCagcCFkB0sKhZIxMtsCU99YK75J2ZAY /6cIR5qH9bXc1HnfADwgQsvaabj2SUPXO+Qr+kU7IZOX39s9ZhA12CPoNQxqf9XhPpn0 s9gH0EphySeRjifZABJzlM7JA3b9uk3yHIxzoVfRxDCparIdnmIEocQ4NbzAJLeYFu7r 9uf2EiJjQNvKXa7bUyeZoJMzwwMt5Ll+7aU5jlpzAseHk9MgFTTY7nvYfkbMyXM8IckT bkGNkR9s/OfYBHxl822ise1gL0LhxIATVKgEVuRFpjErpADhvQVSzh5jSuwtqliHCHUu gy/w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="iMghq/rH"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-56782-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56782-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=2; AJvYcCUsTfsLHTQJIv5yFiMyZzkqH8SAHms/506VUmJbm2+JX4JNyP+9XCrJQ/XzKYTj9JGuVrr7+HQTbCzjtappnpjEF2ggtN2OAw5yAG//9g== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id i13-20020a170902c94d00b001d67ee9872bsi2109336pla.133.2024.02.07.08.41.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 08:41:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-56782-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="iMghq/rH"; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-56782-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-56782-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 713C128B635 for ; Wed, 7 Feb 2024 16:39:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5F57281ADB; Wed, 7 Feb 2024 16:38:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="iMghq/rH" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7CC5281ACA for ; Wed, 7 Feb 2024 16:38:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707323924; cv=none; b=S89oAG/5PbXE7dFPvvQciSigFjpCcwCPuOu8+mmyYkmp+K+0G0nhAECj7SWG0RdwQqrGvZDlLOFsAD7M+vx/85pMmqZ2Fy8J8i8cO8I2xMNDMILYQM7hYFtlVczvXYpRg2ivBfjNxdeVS5k1HtP9kdlCEPjpx2vbcq3cJPbdzvE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707323924; c=relaxed/simple; bh=yYV90edUO6IBYkZTKapElVIsZy637LpXyy4M8oFz3bE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=iX8YT9IBJCQ7ZHuoIafzLXT01BlfgG+5qCP5mhzpylYcjepwuArAmJh/z/cA9ShTcVmIRgqrguOr/mlwLk87AkwRW8A+cQGq4XIhzYcrhKLC/T/G3h9lTWwg9kiV9nWvVEolvcpkdmXW0GPvyXY+HSG4xwKM3DNZek71LldHsa0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=iMghq/rH; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707323920; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Q3J41sYakbr7nCpsD0r1AspXJMKiAGuYob6ug5klcDE=; b=iMghq/rHUGC5sOFPB8Hi9E7u5n5848J1z4rqtN654xuw8w7jDb0O6sRna4KaDHOvFUH1Lu 0eG28+WHkAvlmUuQWdP+MkLxjzNtDHCZayPYgjttBPaasgrVUCGl4gzsloWJvISdmELXks zLEfe6ehcfzBM5mZ/lRR/sxnIIXe1I0= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-399-06INBmvBN5SXWsXDgT0wbA-1; Wed, 07 Feb 2024 11:38:39 -0500 X-MC-Unique: 06INBmvBN5SXWsXDgT0wbA-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-7853d5e398dso102250385a.3 for ; Wed, 07 Feb 2024 08:38:39 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707323918; x=1707928718; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Q3J41sYakbr7nCpsD0r1AspXJMKiAGuYob6ug5klcDE=; b=o8DIHS5FfIosLGj4X5vGn95MXPmpNBcQ7LD44/QVlSph9BBArsX3yFhiVT5OFamN7c UqVlxlxdDO1oQ/4ilQlVJgX4b/kdUaNbukrFuCL+adOxoibUPEkGCdtBbXxZJGKbtywp rk8bbESlgB4I1iWLwPSP0EO4XymHOSCLtwkfrsT/IOUx9tGVDN3iKt2U4h4XI6w+EI4S bl68EeyyosIkQD1kCtvc1LFQYex/QhKYtZZgwlBmrwd8NmaRDUkRRJHdmXfyc8kq8LUj NK+bocNvoXDcxbiukki5mPZRZsQU50r66btpUO9B9lEqvMUu0OjcgPNeH3Klar21a+DU HENA== X-Gm-Message-State: AOJu0YxDBO97c9F1XV9/UQ76KdGQpGz1t5o3aYGFl2jUA2E8OdDCAVE+ 0KsXysndq/kFquRvVgVOuBJlgfERVDtkPFoQRhBoYeMHoUiqOw4YpAuYRZTy4FW/WQabsk7FMjL RLm/HIDl6g5mZNwUvScC1CH7jlOkbE5MJ69znB7pQs+/M1+BrVkirzDyCKqHlXQ== X-Received: by 2002:a05:620a:4620:b0:785:46d6:6453 with SMTP id br32-20020a05620a462000b0078546d66453mr8619126qkb.32.1707323918660; Wed, 07 Feb 2024 08:38:38 -0800 (PST) X-Received: by 2002:a05:620a:4620:b0:785:46d6:6453 with SMTP id br32-20020a05620a462000b0078546d66453mr8619102qkb.32.1707323918350; Wed, 07 Feb 2024 08:38:38 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCXRlQ2kj5BCUsqdr5MMIndRdzdUBRc4MiqRznozuly6meVvpHGVfmkdbwYOUf94wUWuZrYm1uEJ9HtRqkUBtS5lZKBPN+R2DGN8vO6b59SWsRtYXgUKNLh0bU/9FJ3wzFW6urLaUjH2AGPo75FD0sBlLZonRd7lDrG0n3g4Q34FAWnM9ry2cxIemSn++NzGk2K6diNvTBS6UNh3+l3XbQwFJatQ5n651ju0MWDAxcY66G90/uaG4edgyJWxM6m958Bi4G1TL3tMZUvts2+fHxkYsdE6v6YuUiUqYDRdp/2x1SWhnzh/oUzO Received: from localhost (ip70-163-216-141.ph.ph.cox.net. [70.163.216.141]) by smtp.gmail.com with ESMTPSA id b3-20020a05620a088300b007832870e803sm658476qka.68.2024.02.07.08.38.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 08:38:37 -0800 (PST) Date: Wed, 7 Feb 2024 09:38:36 -0700 From: Jerry Snitselaar To: Robin Murphy Cc: joro@8bytes.org, will@kernel.org, pasha.tatashin@soleen.com, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org, rientjes@google.com, yosryahmed@google.com, john.g.garry@oracle.com Subject: Re: [PATCH v3 1/3] iommu/iova: Tidy up iova_cache_get() failure Message-ID: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Feb 05, 2024 at 03:32:39PM +0000, Robin Murphy wrote: > Failure handling in iova_cache_get() is a little messy, and we'd like > to add some more to it, so let's tidy up a bit first. By leaving the > hotplug handler until last we can take advantage of kmem_cache_destroy() > being NULL-safe to have a single cleanup label. We can also improve the > error reporting, noting that kmem_cache_create() already screams if it > fails, so that one is redundant. > > Signed-off-by: Robin Murphy > --- > drivers/iommu/iova.c | 33 ++++++++++++++++----------------- > 1 file changed, 16 insertions(+), 17 deletions(-) > Reviewed-by: Jerry Snitselaar