From patchwork Fri Sep 13 19:20:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mina Almasry X-Patchwork-Id: 13803987 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A9A1FA3750 for ; Fri, 13 Sep 2024 19:20:54 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E54A26B00C1; Fri, 13 Sep 2024 15:20:53 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E041E6B00C2; Fri, 13 Sep 2024 15:20:53 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CCB456B00C5; Fri, 13 Sep 2024 15:20:53 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id AD42F6B00C1 for ; Fri, 13 Sep 2024 15:20:53 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 31D7EA9ABA for ; Fri, 13 Sep 2024 19:20:53 +0000 (UTC) X-FDA: 82560682386.17.15974BC Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf28.hostedemail.com (Postfix) with ESMTP id 098A3C000F for ; Fri, 13 Sep 2024 19:20:49 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=lKeEgaZc; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf28.hostedemail.com: domain of 3kJDkZgsKCIEfqrfxw3rnsflttlqj.htrqnsz2-rrp0fhp.twl@flex--almasrymina.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3kJDkZgsKCIEfqrfxw3rnsflttlqj.htrqnsz2-rrp0fhp.twl@flex--almasrymina.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1726255220; a=rsa-sha256; cv=none; b=3phdaZLYt/fTNqnWmcAHXUsmr8+VQ+jeLEwS8DQsNh6ljxdlZRu9UaZqls+Yu3JDmkzJx5 nlcgh16Ju5jUhf5NPxrXbxc0Qyo22DHUv2Wee4d6R9esgVUaWmgCXbfAPXRLah7TisBMpL w0xzAXa2Gg0XslpqwSWHLJfufwoI1yY= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=lKeEgaZc; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf28.hostedemail.com: domain of 3kJDkZgsKCIEfqrfxw3rnsflttlqj.htrqnsz2-rrp0fhp.twl@flex--almasrymina.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3kJDkZgsKCIEfqrfxw3rnsflttlqj.htrqnsz2-rrp0fhp.twl@flex--almasrymina.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1726255220; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=XyVwmJzFbJ/oT6rl4j6NoyNuLyObf2RLXKIfBjhIh5k=; b=tDpYNPaslVsrXqSR+zavGAv37FWan0wA4DA1gKl1w6+PPCTF9XlOG/H+p6kg8TIFy/OMkN QZUIu0YpOvWs7rMXHfN6dYV8q4hqwoNnVtVLVtmQfDpClVGxESmrOhORg7dKSR25TMyHCV QoSH6kDPuJuofbpO0mJXaeZpEm03WtI= Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-6b41e02c255so29141537b3.3 for ; Fri, 13 Sep 2024 12:20:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1726255249; x=1726860049; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=XyVwmJzFbJ/oT6rl4j6NoyNuLyObf2RLXKIfBjhIh5k=; b=lKeEgaZct1PZsd96wWYqm+wY7NBKLK0A3YVyCkKgX1SFI8DMADtGlpmiIrQ8/wG0KI 0cnAsxy0b4ilbfYWE53fRdjESDn7CYjKadT/z6oeBbIhD6nv5w2qH06DfFu6L2Nr+dDR QSO6oB1Fj27Q/16FNnkBKQ/iTtE/NL8ivvb05i/m3Bp722Q218OCawdhH3DX3CP+/uOi ndbau7qpt5Xiy7JaHyjmMbWFI3yDD0fxUkiC3FbV52AXrM1Ss5T4IoSJjYPgA1oVY875 MPewbYEByePRx9wt89rkmpo2J32vzSzV3uz2ahOSsMr4PzMpUvwR/TUQQ44iQygp3HtX OpBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726255249; x=1726860049; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=XyVwmJzFbJ/oT6rl4j6NoyNuLyObf2RLXKIfBjhIh5k=; b=Z1ykYtzzepMUsOxM4TsQZqsGsU6fMOs+3bXTPZ0dtlYbWGDuH3i2yPQ9+6ZVaeB8gu HkqLKTzeuqFQ/K4pkNdVXg1mwerRzgN1XLw5FscYAPdofm8mRwO0lBV/KrTk7tFSIjYo FRQxtWZqhXgQtLrtDWqphVgEwBykxpKW6AAr8CuejFYbW43WjePRom9TX7SVZQVl2aLY rg6YUXD55GmLJ95P2PoFSQYuuN7lD0G3lWGfyNycnxe3bsG2d58TnUp1kJZReOFUdo46 uo52nOO9hRtc1LVqdyqTlIIaRYUUXEH6GcNmH9dQyHVv4gYNx2RebaG4iDOnS7Qm6pJN xvzw== X-Forwarded-Encrypted: i=1; AJvYcCVxjWNB4wCD+KaVqLboYRJ7BFS0IZtjWW4k5FZll/NlbfLMt61YqkTt2x2OpIgz7aYbgYMkGjMaCg==@kvack.org X-Gm-Message-State: AOJu0Yy2IwQ7V9+RKzdJAWnml2Y5QjMlUFvy4Of6ZIINRz9yQuRvfZ5s Y6AnujCLDw0reB3vWBS09SpMibV93Lyr8a2RQfPL0l2Pr/wDe9sJcHOr+7cvO/ewsLGT9JE0Nc0 wiocrmeYj88gdwG6q1MxGhQ== X-Google-Smtp-Source: AGHT+IFDF32N4mQwATZNCLz25QLEOkKmOIRWCMujqX0ZzKlzsSNpONZ53k1X0A26W9ZzFOaKPw2IjNpPtPK3sfm+wg== X-Received: from almasrymina.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:4bc5]) (user=almasrymina job=sendgmr) by 2002:a05:690c:7487:b0:6d5:df94:b7f2 with SMTP id 00721157ae682-6dbcc579a34mr1597487b3.5.1726255248865; Fri, 13 Sep 2024 12:20:48 -0700 (PDT) Date: Fri, 13 Sep 2024 19:20:36 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.46.0.662.g92d0881bb0-goog Message-ID: <20240913192036.3289003-1-almasrymina@google.com> Subject: [PATCH net-next v1] mm: fix build on powerpc with GCC 14 From: Mina Almasry To: netdev@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Mina Almasry , Andrew Morton , Simon Horman , Stephen Rothwell , Jakub Kicinski , David Miller , Paolo Abeni , Linux Next Mailing List , Arnd Bergmann , "linuxppc-dev@lists.ozlabs.org" , LEROY Christophe X-Rspam-User: X-Rspamd-Queue-Id: 098A3C000F X-Rspamd-Server: rspam01 X-Stat-Signature: g78cirbgb339jgrnuanj5k64krdsxbyk X-HE-Tag: 1726255249-137737 X-HE-Meta: U2FsdGVkX1+2L1sCK48FlRGppFitn5WpLjF5rAMiqkP6ifsOtgY92UWGXtuinFGN8B0rXHn5G6wmoOb0RqdtPaZWEDPN2pw2UdaobVqiPUc8V2h9yyA8KHnsFQqe8F7uk8VTEKrIkYdsSW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LeQ7LB+sUe58V1SDuExwgPHe+5t9LqQmul2u5JnnRg8y34M1CPj9I6qdkDddsHF7PNUb6S22DTYJbnXUKDT/NdXFzQoShd2x9NXe4aITeUMuJ75X2PsVhBrd486j4pxC3bAJKoGrgMX49KPnB7LID0RsbARF8myZkLMx/CpaWE49OGMOd/+TbJdjBsroQSSXiiDZ+fTeB2nFz3/iArVKVBfw7DYmhaZGUNTRfpzYNIJYUcbzzgogU3wTeKzCPpP5sEktjYlNafp7sriB0mfJ1Pasq1o3isvDsXSm6RJA6T6shxM7plVw8AiIJIIbeuswWGl+hMw9L7bH5nLPpCd2rozd+yNxe4Kw8PTPs7bcUaaofiTjoI2GHJKvM4gTzDzohiYtL60XEbcXHgOPlvCTOy78g1JQUnqeGnxvi/icxBQoKgFjw14qkC5j9gDidiG+oPNpES6YKS9lwMETQnkt13zfGbq7AZmqLCAYVGk3W5pQ69rV6Ac7sROBhzq/ZNDB2L/8py3bPa/8u9OHj/K/2tEwFMmiIwz71lClgivYh2wpnP0sOWyclwLcyAJupF93Gg3Xx4R7khG/2GSHXpWwc/1L8fZ77GSZz4fxtIcDeo6UvH0tuyLMZ1BA3KgBkEuT8fAeGdnpH59CbxrTfFESW8ol031vqZSJubHoZ5EfTx2PlbmTg== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Building net-next with powerpc with GCC 14 compiler results in this build error: /home/sfr/next/tmp/ccuSzwiR.s: Assembler messages: /home/sfr/next/tmp/ccuSzwiR.s:2579: Error: operand out of domain (39 is not a multiple of 4) make[5]: *** [/home/sfr/next/next/scripts/Makefile.build:229: net/core/page_pool.o] Error 1 Root caused in this thread: https://lore.kernel.org/netdev/913e2fbd-d318-4c9b-aed2-4d333a1d5cf0@cs-soprasteria.com/ We try to access offset 40 in the pointer returned by this function: static inline unsigned long _compound_head(const struct page *page) { unsigned long head = READ_ONCE(page->compound_head); if (unlikely(head & 1)) return head - 1; return (unsigned long)page_fixed_fake_head(page); } The GCC 14 (but not 11) compiler optimizes this by doing: ld page + 39 Rather than: ld (page - 1) + 40 Causing an unaligned read error. Fix this by bitwise operand instead of an arthimetic operation to clear the pointer, which probably communicates the intention of the code a bit better anyway. Cc: Simon Horman Cc: Stephen Rothwell Cc: Jakub Kicinski Cc: David Miller Cc: Paolo Abeni Cc: Networking Cc: Linux Kernel Mailing List Cc: Linux Next Mailing List Cc: Arnd Bergmann Cc: "linuxppc-dev@lists.ozlabs.org" Suggested-by: LEROY Christophe Signed-off-by: Mina Almasry --- include/linux/page-flags.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 5769fe6e4950..ea4005d2d1a9 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -239,8 +239,8 @@ static inline unsigned long _compound_head(const struct page *page) { unsigned long head = READ_ONCE(page->compound_head); - if (unlikely(head & 1)) - return head - 1; + if (unlikely(head & 1UL)) + return head & ~1UL; return (unsigned long)page_fixed_fake_head(page); }