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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1E1D3CFA774 for ; Fri, 4 Oct 2024 12:45:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=HSOAqw79gXVAVkv8I96SO09KcBqBwdwHMfyZ5HwM23M=; b=ccDRUS9lgNbxpkbEYW0mnMY6BZ RXDEGXdCeq/PH9tYY5OCv49yJ3caAwqmKWtN3K+QDl6/AILSHsibxnPC4MqMvu42QzcZw0BbcRw27 8GhFPV77nexUVv1mvLTW62u5Zq9cK7uAWr8jsnAs5StuHn9jeIYhQTfvBcyguVKXiFqN0P8yJmRtv pc2y5uCuegvlEjrnJpuM61iY2ZtCez1Ib3ZyrTc8NITiso6/yFMNRoCdsh8cOZix+D5r0e3i2GhVg YlJEN+uEZCUPTmLBSGZNlnTbQJT0ToyfHIiRW2JGZGWxecmvrtAmEoANc3O6ZLq6d415sLQOSnU8v tOMR1FSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1swhg8-0000000CMUQ-3ii8; Fri, 04 Oct 2024 12:45:04 +0000 Received: from mail-qv1-xf2e.google.com ([2607:f8b0:4864:20::f2e]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1swher-0000000CMFr-3vKp for linux-arm-kernel@lists.infradead.org; Fri, 04 Oct 2024 12:43:47 +0000 Received: by mail-qv1-xf2e.google.com with SMTP id 6a1803df08f44-6cb284c1a37so17086716d6.1 for ; Fri, 04 Oct 2024 05:43:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1728045824; x=1728650624; darn=lists.infradead.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=HSOAqw79gXVAVkv8I96SO09KcBqBwdwHMfyZ5HwM23M=; b=onEXISTxCKXWNgPBdKvsXxOBUxiMN6xxiK2C7FLKi8XH1CgwMFoqlT1C3py4QEyzB6 IrwixW2h/MO92MwpwjIYUTTAvBJ0L4ElkKD6mKUwx1nPI7cryoRcFIFBb5Kgm6O1V0Q5 MXjWAAzzop+pEMmFI9Y0nBKyflGDnc+LFLCQZOIRVVBIHHUyQu9wYrwrHMaQzjXLwgRm XNeQUqSH8XNwZORez0SyER7HxzANwkz55iIQj3KnMRswb9LHN2W2LoQ2H1V7DISgbTh+ G970t9SW2Dyc5uY6OsL0ZDX55+n3pyIuHEqXGK9kDGDGV8K16yrp+4OVs2wNcQsA9cUd P7Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728045824; x=1728650624; 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=HSOAqw79gXVAVkv8I96SO09KcBqBwdwHMfyZ5HwM23M=; b=XxIyj3hFypx0T9Glez2QIz4Y7TsBG1rXxv9QDcTIxXZ+8DZknuR8I/6jlAaZoeaJP3 /RgpSUuedS8OLrrEhqTF5hJyMgCpq1v9he6Qysbs+90GGJZhZ28soH7dSXnKC/eLQLlp a63u1oUrX34l36AHNLTXFid7ONXbkbAO8h7kLQPelwZAK84I3dD3i9Qtn0WRHrUUPKjg 72h1k2QytrtWPLPTDdsOxnNT4Y+6v5bSijDunWsz1XS/xLBvrLWoygvWY+E2GYBEnJJl jscqRnx2swalcwX6o2OHwhriOcuVV5z8MA7r7ZP7IjlAIrHBoBwvckAi8MPncpMT9Ndq xhzw== X-Forwarded-Encrypted: i=1; AJvYcCVCb1vHafGVwdiRKjOUex1UhPVsNqsnI0N1sEXAzyDpFa/gaz55Yy1qthu0FBN0t3KCbKQqy8GWf0liwjasLixD@lists.infradead.org X-Gm-Message-State: AOJu0YwuUraz78aAuWoL7FpMl0cW3Y1JYujyQpTAv7gX10WqvwbWERfV 1SKGz4bReXoNRNi6T+CviBF6aGq/cMrI3H1VqaItpjQD24nRZlEFxcJ25sSzcas= X-Google-Smtp-Source: AGHT+IH+lBEw9Gy7ze1H4cjY01Q+qaaLegOnnDxsIEJsjc592NIky/t8xlw3yrAV1RLwJUr+c1mMjg== X-Received: by 2002:a05:6214:398a:b0:6cb:2565:3f5f with SMTP id 6a1803df08f44-6cb9a490b83mr25471536d6.51.1728045824196; Fri, 04 Oct 2024 05:43:44 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-128-5.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.128.5]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6cb9359c013sm15335776d6.18.2024.10.04.05.43.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Oct 2024 05:43:43 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1swhep-00CeVI-0I; Fri, 04 Oct 2024 09:43:43 -0300 Date: Fri, 4 Oct 2024 09:43:43 -0300 From: Jason Gunthorpe To: Yang Shi Cc: Nicolin Chen , james.morse@arm.com, will@kernel.org, robin.murphy@arm.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [v2 PATCH] iommu/arm-smmu-v3: Fix L1 stream table index calculation for 32-bit sid size Message-ID: <20241004124343.GE2456194@ziepe.ca> References: <20241002175514.1165299-1-yang@os.amperecomputing.com> <1c9767e1-4d05-4650-bc14-65a18fc63cc2@os.amperecomputing.com> <20241002194004.GT1369530@ziepe.ca> <20241003111603.GU1369530@ziepe.ca> <43c2227a-71c9-4cbf-bfec-5a2fbf698f27@os.amperecomputing.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <43c2227a-71c9-4cbf-bfec-5a2fbf698f27@os.amperecomputing.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241004_054346_175099_99C2785F X-CRM114-Status: UNSURE ( 8.63 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Oct 03, 2024 at 08:31:23AM -0700, Yang Shi wrote: > If I understand correctly, the check is mainly used to avoid the u64 -> u32 > overflow. This check guarantee no overflow. If some crazy hardware really > requests that large memory, the allocation will fail. Sure, the kalloc will print a warn on anyhow if it is too big Jason