From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9ED854718D7; Wed, 23 Sep 2026 10:10:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790158242; cv=none; b=Hl9kX9t46hcAIRCCTW/lvV+uGn3UqPPyURvKfNS5uA99/5FyGk2Z7l7ac5b3It/Zu2HIrGWVzUJ0T2M0f4OI9hjJuQ9xYHwfm5fNma2UN3AWr6f5+8H3OZUM9QOE+obhp2w5NNw1wSHs+w5EOPHFqOEH12OrLZkqbUCn8MYF5cQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790158242; c=relaxed/simple; bh=aJd5PwgdVPJ9tE7A7OasMy/wKrzLGbTgJY/jXplpFIQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=ocaTdjwIHvxSWaz6Ksfxg5R9eekA/ZjM92hpsIwyjujiwHwjGREc8xla8Fe6thn8j1RGelav5l0SksirmI2lOMFoKLe9wwC/DjY9uiyMyLExHWCJ0bawVKhJ94iCvGVWsIsCSkMpF1JhYwoRNgyBsITQoyhOxDPgUIWst5AXkW0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=N3sYQleb; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="N3sYQleb" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A8480152B; Wed, 23 Sep 2026 03:10:34 -0700 (PDT) Received: from arm.com (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 146163F86C; Wed, 23 Sep 2026 03:10:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1790158238; bh=aJd5PwgdVPJ9tE7A7OasMy/wKrzLGbTgJY/jXplpFIQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=N3sYQlebo9JuaPrX/aY4BYXg4kl12bBh2l+dg5S1TpD/sd1OrXwH32xGOiPW5K434 UuBzqurGcjPFaH0amX7WpALPGj4+fE2hTuRxrmfBQJcpZcj2x3NVvhpckvNi+KxnQI AtUULuSivZdyBUiepK0KoTPupOCiWcVRdZmElWyM= Date: Wed, 23 Sep 2026 11:10:32 +0100 From: Catalin Marinas To: "Aneesh Kumar K.V" Cc: linux-coco@lists.linux.dev, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, Andrew Morton , christian.koenig@amd.com, Jason Gunthorpe , Joerg Roedel , Marc Zyngier , Marek Szyprowski , Robin Murphy , Steven Price , Sumit Semwal , Suzuki K Poulose , Thomas Gleixner , Will Deacon , dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org, linux-media@vger.kernel.org, linux-mm@kvack.org Subject: Re: [RFC PATCH v7 02/13] mm: Add an allocator for CoCo shared memory Message-ID: References: <20260921144847.501151-1-aneesh.kumar@kernel.org> <20260921144847.501151-3-aneesh.kumar@kernel.org> 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, Sep 23, 2026 at 02:01:08PM +0530, Aneesh Kumar K.V wrote: > I was pointed to this email thread: > > https://lore.kernel.org/all/c25502d3-35c6-4281-a9ec-856f789fb1b4@arm.com > > This makes a stronger case for having a CoCo shared memory allocator > that captures all these restrictions. It also means that > alloc_cc_shared_pages_node() needs: > > if (WARN_ON_ONCE(!gfpflags_allow_blocking(gfp))) > return -EINVAL; > > might_sleep(); I think gfpflags_allow_blocking() is the wrong predicate. It checks for __GFP_DIRECT_RECLAIM but we have callers like dma-buf which clear the flag (see HIGH_ORDER_GFP). ITS allocations also use GFP_NOWAIT, so they'll fail here. I'd just keep a might_sleep() in cc_make_*() and ignore gfp flags checking. Passing a no-blocking GFP flag doesn't necessarily mean the caller cannot sleep. It might also happen early enough (like its_init()) not to care - __might_resched() skips the warning if SYSTEM_BOOTING. -- Catalin