Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp7207009rdb; Wed, 3 Jan 2024 08:01:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IHlUrZ4hfibIKzPR7NGJY9mkgN2J24gEzrnesmtI/1gQD4vqjuXzadvOeFS45rrcNyAe501 X-Received: by 2002:a17:907:cb01:b0:a28:a13e:2339 with SMTP id um1-20020a170907cb0100b00a28a13e2339mr392544ejc.61.1704297711970; Wed, 03 Jan 2024 08:01:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704297711; cv=none; d=google.com; s=arc-20160816; b=R2l6MlYOlZUH4izY0i8YB3tQk/bjrW6ACoP86sBA74sqqmA4T4pEjDVQuCdY2imuDl KrMKO1mW5pfrIe6Iej4Ar8alUv9Pxe3s2klfx/RLlpNRv2FeH+dAvZdN+ZoyKb+pked4 gnHBYiudUqEb5I7XMl6wyWdR/+Q8qsI1t+cseNKQe8Rpy/S75B0CnLtoeAhGj+Md101i 3/veuLnplztR3r8rqC3SsoLnWQO52xsF6IMHnVUfKcjjMheZlWUv2c57idAx1WCeO64/ 8cC08ZW02FBSOnlyeyKWizQsu4oBTmL50mNh9KJHW+mNVuhcbO76Hcsv2xA9XcJbFG2x Kdbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=9dWOLJ/7H2GD4Bb9fMRINczeyfjJ7YRASwlhClz2V/8=; fh=eBmKK8cc9weSPBuHTqRRSad+J3mMZA8jBAg7hzQqtjA=; b=vU4rgqmgKi58gpvHOs3DLiTdiwrN/00d7ERC68LMYYlTjAqyvz9PqxkZ3yDh24Hsig ajzoy2vxEQAaBZi++xOQ4iYOGWT4uIi1llTha0agUcpvEa9EicLcUhKKd9z7TilWYPdE yFIOCMrW3DTlo2FR/TIdkcbqPsxIWQnk8ml+rl92+wDjrK7JKJsBuENyQQaUXRlnWcbr DIom72aPTswzrpF4DJin/mntZ4DElIyRCpJq1uAP4xLTePu3/Ot4SqOUN1wp/NKcY+gt 4E5rd0/iY1zA++Ezy1/Cr7G5HhhLz/Oxck4tiAc4BaypaNpd5DMK5+TTebDTT2cr/AsO NCjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fx4uJPV6; spf=pass (google.com: domain of linux-kernel+bounces-15725-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15725-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id n6-20020a1709062bc600b00a273ba45401si6807088ejg.1005.2024.01.03.08.01.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 08:01:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-15725-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fx4uJPV6; spf=pass (google.com: domain of linux-kernel+bounces-15725-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-15725-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 89E981F23C80 for ; Wed, 3 Jan 2024 16:01:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2B0221C2AB; Wed, 3 Jan 2024 16:01:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fx4uJPV6" X-Original-To: linux-kernel@vger.kernel.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 13DC11C28F for ; Wed, 3 Jan 2024 16:01:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1704297667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9dWOLJ/7H2GD4Bb9fMRINczeyfjJ7YRASwlhClz2V/8=; b=fx4uJPV68TmmMfotRmjkLGn+XevVdYX4GqNVsuLOmaLWAi6CrJF/OdeMugZ2ps0kogT6my l5ZnuPO+B9tyvzFHK608z6YTLAep+A3FjVl88wT88azm+kdCvJkfIWPjXQ0da+7yJZcy01 kwNIaCdZcF1F36IK5NyhLuZXyOsFNtk= Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-621-MSnx8RpiMJSCM5tuaQfN7Q-1; Wed, 03 Jan 2024 11:01:05 -0500 X-MC-Unique: MSnx8RpiMJSCM5tuaQfN7Q-1 Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-28bbe965866so6292571a91.3 for ; Wed, 03 Jan 2024 08:01:05 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704297664; x=1704902464; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9dWOLJ/7H2GD4Bb9fMRINczeyfjJ7YRASwlhClz2V/8=; b=fHVlTGhaZaDCuuiEubKo3VzI6dYSvrgXjdkxJAGTTJDgz9AnlYUDMRR0GIDUMqHC86 ///A9XDt9vBnC3k/ALn6rFiFXopefr8gpQ/8h3CxSvfhU3Q03SxpCrDLiD/IGxVFAySK 8IyFniTQO28MaGcb4UTtjj5DGSXRnFYKiwZPhNDGkLqc5lVu0C/KTiFtvrxKkp//QuEi y0WxlGrQG1OO2wqV+R8xGsxa9+WIQ+X13hmuo9wA6tWlFtDZG5dmvNbB1wJAcB+/yGna gDYR7GwbUZhBc6aDb3nxGDf2EH0zuG/F1xZhUZWk9K6koJjYaajCX/SjGlw1NYPmVJLt ctBQ== X-Gm-Message-State: AOJu0YymyErTU68TySHLPIuZrAovU3R+p9b7jadRzxQbc0FG6syllSTj VoiPueoKa8bwRDnXM9FXi3sroZ2B6/vTzmbBGsDD1ECJLhS+TMcko+KiRE6MFynK7i7mdL3PJ41 S2xcY4c2ID3JWulmbD232YB2YtXj01+J8 X-Received: by 2002:a17:90a:cc18:b0:28b:157c:e48d with SMTP id b24-20020a17090acc1800b0028b157ce48dmr6484899pju.78.1704297664231; Wed, 03 Jan 2024 08:01:04 -0800 (PST) X-Received: by 2002:a17:90a:cc18:b0:28b:157c:e48d with SMTP id b24-20020a17090acc1800b0028b157ce48dmr6484861pju.78.1704297663874; Wed, 03 Jan 2024 08:01:03 -0800 (PST) Received: from localhost.localdomain ([2804:431:c7ec:911:6911:ca60:846:eb46]) by smtp.gmail.com with ESMTPSA id qc8-20020a17090b288800b0028b1fce7c01sm1922253pjb.37.2024.01.03.08.00.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Jan 2024 08:01:03 -0800 (PST) From: Leonardo Bras To: Paul Walmsley , Palmer Dabbelt , Albert Ou , Eric Biederman , Kees Cook , Oleg Nesterov , Leonardo Bras , Guo Ren , Andy Chiu , Conor Dooley , Xiao Wang , Vincent Chen , Charlie Jenkins , Greg Ungerer , Andrew Morton , Kemeng Shi , Alexandre Ghiti , David Hildenbrand , "Matthew Wilcox (Oracle)" , Qinglin Pan , Greentime Hu , Baoquan He , =?UTF-8?q?Cl=C3=A9ment=20L=C3=A9ger?= Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH v1 2/5] riscv: Replace direct thread flag check with is_compat_task() Date: Wed, 3 Jan 2024 13:00:20 -0300 Message-ID: <20240103160024.70305-4-leobras@redhat.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240103160024.70305-2-leobras@redhat.com> References: <20240103160024.70305-2-leobras@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit There is some code that detects compat mode into a task by checking the flag directly, and other code that check using the helper is_compat_task(). Since the helper already exists, use it instead of checking the flags directly. Signed-off-by: Leonardo Bras --- arch/riscv/include/asm/elf.h | 2 +- arch/riscv/include/asm/pgtable.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/riscv/include/asm/elf.h b/arch/riscv/include/asm/elf.h index 06c236bfab53b..59a08367fddd7 100644 --- a/arch/riscv/include/asm/elf.h +++ b/arch/riscv/include/asm/elf.h @@ -54,7 +54,7 @@ extern bool compat_elf_check_arch(Elf32_Ehdr *hdr); #ifdef CONFIG_64BIT #ifdef CONFIG_COMPAT -#define STACK_RND_MASK (test_thread_flag(TIF_32BIT) ? \ +#define STACK_RND_MASK (is_compat_task() ? \ 0x7ff >> (PAGE_SHIFT - 12) : \ 0x3ffff >> (PAGE_SHIFT - 12)) #else diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index ab00235b018f8..1d472b31e0cfe 100644 --- a/arch/riscv/include/asm/pgtable.h +++ b/arch/riscv/include/asm/pgtable.h @@ -882,7 +882,7 @@ static inline pte_t pte_swp_clear_exclusive(pte_t pte) #ifdef CONFIG_COMPAT #define TASK_SIZE_32 (_AC(0x80000000, UL) - PAGE_SIZE) -#define TASK_SIZE (test_thread_flag(TIF_32BIT) ? \ +#define TASK_SIZE (is_compat_task() ? \ TASK_SIZE_32 : TASK_SIZE_64) #else #define TASK_SIZE TASK_SIZE_64 -- 2.43.0