From patchwork Wed Jun 5 22:36:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Edward Liaw X-Patchwork-Id: 13687640 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 7391AC27C5E for ; Wed, 5 Jun 2024 22:36:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C569F6B00A5; Wed, 5 Jun 2024 18:36:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BE1636B00A7; Wed, 5 Jun 2024 18:36:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A09C26B00A6; Wed, 5 Jun 2024 18:36:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 75B2C6B00A4 for ; Wed, 5 Jun 2024 18:36:56 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 2B93D1206F6 for ; Wed, 5 Jun 2024 22:36:56 +0000 (UTC) X-FDA: 82198296432.28.E6AC221 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf30.hostedemail.com (Postfix) with ESMTP id 5E95C80005 for ; Wed, 5 Jun 2024 22:36:54 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=NOtP9+Wn; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf30.hostedemail.com: domain of 3hehgZgYKCBQyx52uG08805y.w86527EH-664Fuw4.8B0@flex--edliaw.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3hehgZgYKCBQyx52uG08805y.w86527EH-664Fuw4.8B0@flex--edliaw.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1717627014; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=HvR2KzRbeN2y+kQBsoY3woptqhul8uQMwsNjpEueFQI=; b=6DJiFxfjIOxA4z8ujQQg8ClDgkDFQ1IxaPVIdDqAiaFO4F5T2r6KTxTXaVeHOX40YUmvOZ KTwUsaBScjZSga6Uh9TzsF26cE8+6oLJTHEOK1SynaCkRQw30/YmAu7/ZUWf92UDZgomHr ZVzlG8Azg9nkOp9IYIrRLLk4yEwBqSE= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1717627014; a=rsa-sha256; cv=none; b=7puR29t+yHq3S6ihePaAnGIBxRYaVeywYuFxj2pmbwbHr2Q6AR/TQ/A+BwE5d9iRofD6Fa FFnCOe+p+MROUF3GAp60jbLv13qftWmzU3uSh86XUVZZhg15JiM/oeReJBocaDjxeGmKA0 Wc56wngOrrqZDZpe68nQzu5ZPJa5Cgk= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=NOtP9+Wn; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf30.hostedemail.com: domain of 3hehgZgYKCBQyx52uG08805y.w86527EH-664Fuw4.8B0@flex--edliaw.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3hehgZgYKCBQyx52uG08805y.w86527EH-664Fuw4.8B0@flex--edliaw.bounces.google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-62a088faef7so18481237b3.0 for ; Wed, 05 Jun 2024 15:36:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717627013; x=1718231813; darn=kvack.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=HvR2KzRbeN2y+kQBsoY3woptqhul8uQMwsNjpEueFQI=; b=NOtP9+WnyHPTOx9PLlrJKfr0c9qa/Yrn7rCFNokaOzQSdSMYfTcvhrPN/++A8Nc39R WNNRDvmgG355J+JxybTcZATaunuzzcacGlEY7B6DkTK0C6HwTxwqRZ64Rm+4jBmREnMJ 3DtTEO+bDMizU1paOg3TJSm027fo0yHI6vrpi/rjPnDYUCQIUZE54N0uzIp3jpFrSHok kCbUKVzBwGMG6ldpmUu/7z9WqII2oHTU2VwNmiX1LjpRH+661aWwKzyUce9fAdxEmfft O3tffwqzFrRBblzF5bxkrjQSCbfHQ0iuE1cpjOzKb+ptoQTUXy/nB4U4OdjudqhJq/3/ SqBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717627013; x=1718231813; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=HvR2KzRbeN2y+kQBsoY3woptqhul8uQMwsNjpEueFQI=; b=sSoWra8pA8srIr4dV6dCfTBlQ6EKUbvJueFVmKOxNydcbMcBFe1c+3gUs0WrRvw4Bd KFq9TvwgfgG+onXHiPdUqQVdUZvZp5t8k+emIrZmC3bUtkeNhSOTTFFT04E2h4c80YwP jvwF+w48f8DNQu/VGsmliqkwiAJR9H2PWrjfIqJ+486zvzJ44+bFurpm87WQ0NSrbQxX bbaPjizzhyBKQCSWsc+iwKHLs1ZPxcnyweoDUo3EwRB6saxYGMtqMkv1TUB2j5Omc0s7 r97vE87eOR8YGfLqCGP8xVzpcgzqrm02z46YXVEFEGq5PGbuFJFb2qSuW52fO+i8UOkg k3eQ== X-Forwarded-Encrypted: i=1; AJvYcCVPSvx2+RZM+JkakBX+ay8wdbZZHiXYO1/kuX4SqxR2WhRImmPo0psfr5Yjz2XnGBP6dIirzy1HtSWjKJoOlXhkU8k= X-Gm-Message-State: AOJu0YzjVWoxoJO08yUQK/obRk4y2/9w8yAkZ8VMsaQZa1eGPiUleLnj 18XY0ccnhxQ9j4wSPox3rMJiqEQqVb3FaTqT/SIT9l/oWH2fqs72vY34csOBtzSoF/51TYdMXEv yog== X-Google-Smtp-Source: AGHT+IHQMSg3BZwEdpTjqj45BkSGSDIqDJ5xpSLfVCjXGbqd16zv34TQGDGB9Qio8PSsr4E5OLx/pSf4zjw= X-Received: from edliaw.c.googlers.com ([fda3:e722:ac3:cc00:24:72f4:c0a8:305d]) (user=edliaw job=sendgmr) by 2002:a05:690c:6413:b0:620:32ea:e1d4 with SMTP id 00721157ae682-62cc6f92037mr2991207b3.0.1717627013381; Wed, 05 Jun 2024 15:36:53 -0700 (PDT) Date: Wed, 5 Jun 2024 22:36:35 +0000 In-Reply-To: <20240605223637.1374969-1-edliaw@google.com> Mime-Version: 1.0 References: <20240605223637.1374969-1-edliaw@google.com> X-Mailer: git-send-email 2.45.1.467.gbab1589fc0-goog Message-ID: <20240605223637.1374969-3-edliaw@google.com> Subject: [PATCH v1 2/2] selftests/mm: Guard defines from shm From: Edward Liaw To: shuah@kernel.org, Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , Andrew Morton Cc: cmllamas@google.com, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kernel-team@android.com, Edward Liaw , llvm@lists.linux.dev, linux-mm@kvack.org X-Stat-Signature: 1gk8xqiu7aqqwhjy9mrpnanouaqd8dum X-Rspamd-Queue-Id: 5E95C80005 X-Rspam-User: X-Rspamd-Server: rspam01 X-HE-Tag: 1717627014-709430 X-HE-Meta: U2FsdGVkX19hduvKUJt3COj7ynopG2waRiwVLSwy7840AX9C6AUTmT5T72E06fSZpMSNjdqGI7G3g4/qysTmNQvtJOCr3t9ZolN93y0Ddr+udDMZ8gv+/Oc/liNj3Xl16SKSDxIP6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7J4F7vQH2capmXMVQTU6Urc0DoU+vg7YnmgaHGVEaXo4E9+QqoOnfozSkfSgMJlOLKqx6J8vEM5gpumDV98MofocfZi4JmYPZadTUieEK/a1Mz5JU9KS0B+W8IQj7xPGTJeZGN9AFCSP9yK9SUd5Mlz/HEU6X6B99xCYT63PmVIEzHJG3obRk8YnqxtFFvRMkHQJKxn2Ce0/iWD8OzCdbyFp4aJh2BOCWnfiAhvkun1IvjSPh5UuVUw45ilcwKWZqskfQNfUp7EQBQ6Xreg+vqyrPZHlghHPxUwVK0Fr3iri8BLkwYEBVtMFi1U4mr+GgOKHZthpYaeKErzZ8oTeOC2mDtfOTzNXIxi2LqkV09s+nA7D6UkYAELzkYl873Svnqim631f79A= X-Bogosity: Ham, tests=bogofilter, spamicity=0.013920, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: thuge-gen.c defines SHM_HUGE_* macros that are provided by the uapi since 4.14. These macros get redefined when compiling with Android's bionic because its sys/shm.h will import the uapi definitions. However if linux/shm.h is included, with glibc, sys/shm.h will clash on some struct definitions: /usr/include/linux/shm.h:26:8: error: redefinition of ‘struct shmid_ds’ 26 | struct shmid_ds { | ^~~~~~~~ In file included from /usr/include/x86_64-linux-gnu/bits/shm.h:45, from /usr/include/x86_64-linux-gnu/sys/shm.h:30: /usr/include/x86_64-linux-gnu/bits/types/struct_shmid_ds.h:24:8: note: originally defined here 24 | struct shmid_ds | ^~~~~~~~ For now, guard the SHM_HUGE_* defines with ifndef to prevent redefinition warnings on Android bionic. Signed-off-by: Edward Liaw Reviewed-by: Carlos Llamas Reviewed-by: Muhammad Usama Anjum --- tools/testing/selftests/mm/thuge-gen.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/testing/selftests/mm/thuge-gen.c b/tools/testing/selftests/mm/thuge-gen.c index 034635317935..d50dc71cac32 100644 --- a/tools/testing/selftests/mm/thuge-gen.c +++ b/tools/testing/selftests/mm/thuge-gen.c @@ -34,10 +34,18 @@ #endif #define SHM_HUGETLB 04000 /* segment will use huge TLB pages */ +#ifndef SHM_HUGE_SHIFT #define SHM_HUGE_SHIFT 26 +#endif +#ifndef SHM_HUGE_MASK #define SHM_HUGE_MASK 0x3f +#endif +#ifndef SHM_HUGE_2MB #define SHM_HUGE_2MB (21 << SHM_HUGE_SHIFT) +#endif +#ifndef SHM_HUGE_1GB #define SHM_HUGE_1GB (30 << SHM_HUGE_SHIFT) +#endif #define NUM_PAGESIZES 5 #define NUM_PAGES 4