From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 01AA233B6F8 for ; Fri, 10 Apr 2026 13:51:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775829098; cv=none; b=A6TxUdpFVWL3d68bnZJr0epqitilWogmE6SNp2Euv6XLe5gl5G7c6l+xhWb+AKseLtD2tBnv8t9aNee8vmFmEd08IWNAQBLUzWbkE/Xz310xfWr8vLYrwnvovmRhN3/Bcttd1axsitN/8NpNkaH54xMDkcV6NXieYwHPMwBl4HQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775829098; c=relaxed/simple; bh=O1/1iGPeFxkiNwtNKXgPqUazZGcSIykQmiesHZQPz8Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ZTu92Aoz0EImGY3CixM9DoqfTEGZTsunYtzNDSIEJiPOyKyepXeLNtRjOzyNkjhClZaT3e7kt1xAmuBoKJV85657bnLfR605Z08WIskkhsTE9+FLMGnJTkVogybWkGL8IQgByantrlpZ+35A/nBVLamUum6wxx8fVCdh+fE6oBM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=pR6Q3OKt; arc=none smtp.client-ip=209.85.222.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="pR6Q3OKt" Received: by mail-qk1-f182.google.com with SMTP id af79cd13be357-8c6f21c2d81so153023585a.2 for ; Fri, 10 Apr 2026 06:51:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1775829096; x=1776433896; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=3rjHMd7udH2co2NdrO+T+4XZB1IgcQV0KCt3Z2nuK+g=; b=pR6Q3OKtlc2dxes7+WnpA6JgJzqosd0FXFa8q/rx8YmQIKHNgRc2VkEXAgY4xMMBTb Eb9Kaoo/k6a/QFpxj3N7vIaDHknA1T/mrr4UjTRNl59z/4m9cr4g3qCcxWmueqefd7ai RPh/9LxVzwnYWg0+5S4U9h9RaDX51rRLhM0iz2ymepKhQ6Q2wT34FpGyqAA8YyHz4MVr mx1ZZHhRu11mknfSgk61WNhikPuvNLXN6Fru9x2n2gGHkGqYWo9azUedaQW9gro/WLsG QCtYEsraLhUv/a8NXfp4qU8Vy3hQBoyZV+re7s5PtpZrKEsnLXYo1Tbr/cnujlE+UsFL aI7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1775829096; x=1776433896; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3rjHMd7udH2co2NdrO+T+4XZB1IgcQV0KCt3Z2nuK+g=; b=Cu64XHTx0eKXAbqeRsqn9yx/DN2qndrTfrKUsdseljUUGGilpGPdU4A9JztghsaCn9 s4YIhEZuJMkOekPCIPImQPtM3WT4DNa1+ibgZs9jbPHe/5MSw+l1gERYqJYNl2vEghKE J6TNRPVRE1ecq2q7tl/rfWpe5Uid5rj3GXLpPFy0ohSuYdAU5VHBk2Ujoww7WG0NOZB+ r5TWtp4uF6hS2lihHz7F3Op4PQQbFlJIvqhQ6LScHmnFkEqY2kHxSbHO1p4XO1jZYIDK hsKWam1tYI1YHWHgvCCKCGKz4G/qlcgdK+B6iRGLpze1uc4PjJQCO4UIfZnnpZZ5fouJ hOrA== X-Forwarded-Encrypted: i=1; AJvYcCV41uFnn2DRy5UABy4ac8Fsq8bAeFtjoDJikrRlHz7Epb+T2ksA0ciEcg6Zc466EYA4LlhSvpY+ad+H3cs=@vger.kernel.org X-Gm-Message-State: AOJu0Yz3hChX4KQAF8MnEASL1P4CMJrJS++UdO6ueA3VOSIK3F7HiTXl Y3WkjhFGfvQaZB8+7PBMemFpX+GbcIz67P7KHgQFB9zDoTBH88PfY1tID6jBso/xuyw= X-Gm-Gg: AeBDieuOy4OE3oh5kTk5j4qfKeZUGq6y2VFc+//cQaFTQdvl11rqHPdc9c0FvTuxbK4 ITF1WGDWNccqoiExXB6hGT6wYkX5LlVInh+VX9v8P/WTyqwm87+RBn1ydoUldlKJUKHECDnEYHJ AKPe0CsyZLdWWEp9eMIvyi2l7ePCXTAxfhSPeFu1x0YSCM0eoz6iEECQu1iZg8juMMLm6jl9Ckq dIvDHA+4S+L/mYo0+j+dJN9QW7LGVASs7mg931GD8pX9xNbY3UW8pZXAxZ1tzo4n6XcUYkfFzUh wWE/9D3b8t4Rhz8PgfiKtUDVfc7czjFQ0iH+DE5PBCdGXFHtvIT542yfX5xVmdveXGmvxn5cNNF Kn9RszBqa+zmmjiFX7FNbRKmhAREgG/81WjrNJ4MXJqdbEYWyIo5y41/Px4hlY6W4VZZJbaoReo iD+KrSwUXERitVmCvNN24D9mMKFsUWjMA6t4krLI66TPfIvUGJ2T4my15ghJui7OvlF33NOQ== X-Received: by 2002:a05:6214:20a1:b0:895:498e:e9dd with SMTP id 6a1803df08f44-8ac86155e92mr44076496d6.2.1775829095763; Fri, 10 Apr 2026 06:51:35 -0700 (PDT) Received: from ziepe.ca (mctnnbsa70w-159-2-73-22.dhcp-dynamic.fibreop.nb.bellaliant.net. [159.2.73.22]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-8ac84cc9b8esm22948046d6.41.2026.04.10.06.51.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Apr 2026 06:51:34 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1wBCGj-0000000EEOS-49Ri; Fri, 10 Apr 2026 10:51:33 -0300 Date: Fri, 10 Apr 2026 10:51:33 -0300 From: Jason Gunthorpe To: Pranjal Shrivastava Cc: Samiullah Khawaja , David Woodhouse , Lu Baolu , Joerg Roedel , Will Deacon , Robin Murphy , Kevin Tian , Alex Williamson , Shuah Khan , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Saeed Mahameed , Adithya Jayachandran , Parav Pandit , Leon Romanovsky , William Tu , Pratyush Yadav , Pasha Tatashin , David Matlack , Andrew Morton , Chris Li , Vipin Sharma , YiFei Zhu Subject: Re: [PATCH 01/14] iommu: Implement IOMMU LU FLB callbacks Message-ID: <20260410135133.GT2551565@ziepe.ca> References: <20260203220948.2176157-1-skhawaja@google.com> <20260203220948.2176157-2-skhawaja@google.com> 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 Wed, Mar 11, 2026 at 09:07:00PM +0000, Pranjal Shrivastava wrote: > > + if (!obj) > > + return -ENOMEM; > > + > > + mutex_init(&obj->lock); > > + BUG_ON(!kho_restore_folio(argp->data)); > > The use of BUG_ON in new code is heavily discouraged [1]. > If KHO can't restore the folio for whatever reason, we can be treat it > as a corruption of the handover data. I believe crashing the kernel for > it would be an overkill? There should not be any new BUG_ON's added at least they need some better wrapper function or design so they are not in end-users like this. But these cases need to fail by preventing the kernel from leaving the initial safe boot memory space (ie it is going to crash anyhow). If we can't recover things then we can't guarentee memory is not being scribbled on and we can't use it. This is the general logic why these are made very fatal. Jason