Received: by 2002:ab2:7a55:0:b0:1f4:4a7d:290d with SMTP id u21csp304694lqp; Thu, 4 Apr 2024 13:49:07 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUU3Du8Osk+lQmedJm9Kx1hC1Oz2fIR79D6LWJ9rHY0o5Pyt+IRC3Sgz/Nu6ppyYanZSFGNhSohbzV2/NFq1KX5AXAvFcb1Z0TEqBK6kw== X-Google-Smtp-Source: AGHT+IFOVVZ5kkcl4feb8fG2CpfVtToXOr1dBNkc7ysz2L+S+ov32de+Wjk3eC0SSJYUX6bgFiPg X-Received: by 2002:a05:6122:251c:b0:4da:9a90:a6f2 with SMTP id cl28-20020a056122251c00b004da9a90a6f2mr4026302vkb.10.1712263746793; Thu, 04 Apr 2024 13:49:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712263746; cv=pass; d=google.com; s=arc-20160816; b=iQvfjx3biNBf7sssVqhZ8E5ybD79CX0X2ePUWgvARRw/i+jjnT9JP1wXg66RoRnNEH v6Um5sSaaa/1bYp9CsCc/jw3OesRkItNXFo2uuKjhFAi+R5PqmLTRZdrQq1k59GOgVhL 2XO7N9mg1ZN+RQ3C9PwFdsC2zpIiWy/vDadGLYrO2MxNj/l9SUwzLNs6dwZQ/tdcMeQ1 /sf/CwY0YyESa/0U9J0TjjLfUcA51gnpv6YLgjdqP6U3xms/dIdU3HcOA3YsiGLtTRBH mrkA//E+aXDe1cXUo7SwJnvh8aNWJpPnKCgm9q2irR93jHx4Mn9kBf5801PFzbCPHo/d WWOw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=33fiqYC3OnT4lVMpQCQzjICTjtiNA2U7R+bnXyZ0lIc=; fh=pgIe70na2xqoDhGhxD8Ne7N0HqTPO/BG+E75rgqMwU8=; b=CYkd7ktINQY3ono2S1lLzkRFUbLeVC+dwy4aK22/tLerZQlBjM56+XJiHh7N7k3pSV Zpt7vyDzeOfTY/4ajDQuRu1HGaONPu2I+X+AlUJoKtpvHm4V0fzJsYmZqsk4yQ75tw6S OFS/FbJOZuaveVIIVD0meX/eNjHVGVEDWCds11hu3gDI1u1Phjbw9gYae4QkuUp4AG49 l7XnY0lwIDW1Lh2hZaFEG+13pYO0tGkPyufYhpw7jh36nydbsHRq+N6aSofa0fDm6Mp8 NzyajA4dJyZtcR3tvOuPFFJ0Gh5tZZQX4ktRsURSkGHuOPIrhhQdoyaAYkT+oI6drtG0 Yimg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=BIfBnDv9; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-132113-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132113-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id jy21-20020a0562142b5500b00696903f7d1dsi180614qvb.19.2024.04.04.13.49.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Apr 2024 13:49:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-132113-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=BIfBnDv9; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-132113-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-132113-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 78D8A1C22CE0 for ; Thu, 4 Apr 2024 20:49:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DAEDE13AA3F; Thu, 4 Apr 2024 20:49:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="BIfBnDv9" Received: from mail-vs1-f41.google.com (mail-vs1-f41.google.com [209.85.217.41]) (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 8C07813849C for ; Thu, 4 Apr 2024 20:48:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.217.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712263740; cv=none; b=Skmz21W7aoWMIBXL0P80M2W4mj1zaE+rcZyS62tXqkIs4Sidd61/SknAorj6JaSyAuQwlLPeRFksZ0O1ppLnnWLbzdaO0M4n5Tntrsc1lc3U18Lglg78BZU7WTm93hS8PSLhVslrZjuE2waVZ1X2SxdMOffyJ9vWH6RRo0d2pFc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712263740; c=relaxed/simple; bh=33fiqYC3OnT4lVMpQCQzjICTjtiNA2U7R+bnXyZ0lIc=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=OoqFgSK/hvteoN3UowGqZhAM74SXqDR0KOi3SRBs932wt3OXAe2sxCayvl0zzQvU8BOlMPAGH9O7ODR9Z3BiaLbpYoEjRbLbKGTnU1SlxpYuPe1EEKc576I8UkcgVuaO1iPiB2UAHNfYEFL5+tcuENb+/xsybu1aZlFEKg8TaFM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=BIfBnDv9; arc=none smtp.client-ip=209.85.217.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-vs1-f41.google.com with SMTP id ada2fe7eead31-479d3ee92d2so263416137.2 for ; Thu, 04 Apr 2024 13:48:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1712263737; x=1712868537; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=33fiqYC3OnT4lVMpQCQzjICTjtiNA2U7R+bnXyZ0lIc=; b=BIfBnDv9GAGnsFabELc5cdOmaasYDTLi+6MYEo3ENdRDFAbjNbAfu828W9gadO8J2E EI9Ic2Tv4yAvEHajeqr80ykT4FhWMRLzaCQ8Vmc293K2j6yzgI4kpQjK9QANa0XrPkio iDhPv7jUDmRKk5Asv1bEdx8pN/ZlG3vPq8XTvY5ZkSOxTjO1dS8Ylgy7q46U7djo7mqW HGk3fRIl8KbauRSOPbe1XCdeltAu6CPftC2RoZX+OLFbE3Tg8oFZjnjnoUHWp/92/XjM scGVQ3IO4eMe2+I7scJDT+Ns7vhGYxIkSUxfDa6u+iz1ryw5bbyrZoNEO7LyRVUBNaaP g/fw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712263737; x=1712868537; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=33fiqYC3OnT4lVMpQCQzjICTjtiNA2U7R+bnXyZ0lIc=; b=iwhEo5eH+vukzKixvej1n3GPs3/OLIhkWergipq5R5w//kBqMi4OO/4kBysGfk001m JytH6fi+UMvab7w9YtRdv+ftRXUTZgZzsw/f6wXnQrYIPEzf35RU68C/lHdkD+/+yOe7 O11ZAsdAVZgZ8dEDmLzh0vDatpHptuTL1LIanMnr96PAkHLi1077vGkytHxX8DVVAwR7 zUHCTphZb+6aGw9HyzNgwJa/MW+SPguWG1ppFr6Maw9VuKhq7ekLOXj79l89C/gubS2B rjpY/EXN6XXqDJ5VlfhZsx6Lsg22ZGziN20rtqiAfYADgBEbFSNmWsgk6ki3MPYllD8V gM9w== X-Forwarded-Encrypted: i=1; AJvYcCWbB7K9JXzIFfC64wZwOJxadkHM5d93Lu7bP4PEogtJtHzk5I9Vl2mG6v04pVEjYZe+CgYv5xubqjyIGW4IPASdroloBTN1bS78NjN2 X-Gm-Message-State: AOJu0YzV8oEcdxddE4wD5Pa16HziKCNCwBu0Dm5qFEv9yMYmlLYCeMK2 +YNFGkFbELxBOB67LKKazeLTnnwMnrc3S8pksVwgjNv2JXvZypdXKhjz3CYC3GR/i0M7bGCr4Bc IukUcvfjaHh6fc7PabyVNcI6cAMxGJRlCEMy9 X-Received: by 2002:a67:ea94:0:b0:479:bfd7:21a with SMTP id f20-20020a67ea94000000b00479bfd7021amr2861352vso.33.1712263736899; Thu, 04 Apr 2024 13:48:56 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240404162515.527802-1-fvdl@google.com> <93eccef7-a559-4ad8-be0f-8cc99c00bd09@redhat.com> In-Reply-To: <93eccef7-a559-4ad8-be0f-8cc99c00bd09@redhat.com> From: Frank van der Linden Date: Thu, 4 Apr 2024 13:48:45 -0700 Message-ID: Subject: Re: [PATCH 1/2] mm/cma: drop incorrect alignment check in cma_init_reserved_mem To: David Hildenbrand Cc: linux-mm@kvack.org, muchun.song@linux.dev, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, Marek Szyprowski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Apr 4, 2024 at 1:05=E2=80=AFPM David Hildenbrand = wrote: > > On 04.04.24 18:25, Frank van der Linden wrote: > > cma_init_reserved_mem uses IS_ALIGNED to check if the size > > represented by one bit in the cma allocation bitmask is > > aligned with CMA_MIN_ALIGNMENT_BYTES (pageblock size). > > I recall the important part is that our area always covers full > pageblocks (CMA_MIN_ALIGNMENT_BYTES), because we cannot have "partial > CMA" pageblocks. > > Internally, allocating from multiple pageblock should just work. > > It's late in Germany, hopefully I am not missing something > > Acked-by: David Hildenbrand > > > > > However, this is too strict, as this will fail if > > order_per_bit > pageblock_order, which is a valid configuration. > > > > We could check IS_ALIGNED both ways, but since both numbers are > > powers of two, no check is needed at all. > > > > Signed-off-by: Frank van der Linden > > Cc: Marek Szyprowski > > Cc: David Hildenbrand > > Fixes: de9e14eebf33 ("drivers: dma-contiguous: add initialization from = device tree") > > Is there are real setup/BUG we are fixing? Why did we not stumble over > that earlier? > > If so, please describe that in the patch description. Nobody stumbled over it because the only user of CMA that should have passed in an order_per_bit large enough to trigger this was hugetlb_cma. However, because of a bug, it didn't :) When I fixed that, I noticed that this check fired. - Frank