From patchwork Tue Feb 27 00:34:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Samuel Holland X-Patchwork-Id: 206981 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2415125dyb; Mon, 26 Feb 2024 16:37:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV+pBWSaCrng8u7TlQHheTUkfPtYmrsCnvG/qcUKCIJ1uzAdK6oORuWijMte6i+BlqDxCiM3XJ9ID0HpXDlGAvMF6Os5Q== X-Google-Smtp-Source: AGHT+IEEN9ZdOkVAyS8xvR7q3LU9BD69yyb8rkq+S6eI7ptdE1g31t7yBfR1QAVWQAPm+pUSzUAN X-Received: by 2002:a05:6a00:2d02:b0:6e5:4956:998 with SMTP id fa2-20020a056a002d0200b006e549560998mr273310pfb.2.1708994240186; Mon, 26 Feb 2024 16:37:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708994240; cv=pass; d=google.com; s=arc-20160816; b=wGHi3qIYQHCNsiklgMqXVEvTR1+kbnpch57ynoK6lGN8iOucBNmJlYabGSP4FWu9E0 QihRvttHA1M9LMcmAyiSElKBiG5LMN7XYJ9U7mrjqFTBJQ5+L/y4dHS7DidmnkGT2G5p VsjRjUstkH87LQNOSU1nGk4wHea04ibZk0X7SCBHNJD1qE8xHxATGjvkxZ9e+v0vSVmq uUQ6OXhXxvaW+vpgyA4pxXXFGu8BA1Uke+g0N8Sj8NHEsviQQf+GoTPZY/G0RDcz+zQr oXNYWNJX9Eg/cnxaqt5JNoqekR3gvlE/0+9QKsbB53d+XWh91bEGOYNIEaE7iw8FnZ5E VWvg== ARC-Message-Signature: i=2; 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=7lRQpFKqbWbNQreMqz6Xcr3vDFL47RlEenB0ubeR/xU=; fh=qgALqhvBfwh64qlTOA5xcM4euFCRJESH/+60UMp8eRY=; b=Y/+DP2iwb1EXK7Ap3Q9bsLifbTsg7deozBFNv0jsi+gyiJnmCQlbJxOXmAY5gvWYsi g9U3xv80d/s83uB8X+wpZOYu5kwdDxBuUSAK7+LI3KWjxlX+n1TgORn83SbWRmrLDFr4 gdgk0gGVyykbaTdebsGk7FoqeoGW8DlSsPRPLK1ej8IYYtiisCeAG67mbQSdUl2H23s3 xyd1dt0EMRKXZibqyoTgm1OSmfgpvGjiRasx/EWMn85LTD9M1wtsPbhxqSXZHNZD91Zo znVF5rqiPUwXdlWIpOXGhXagXyiRG9RrEv0sgAuBfQocXL8v/JPQvDDt3uyymd99zNH7 xeLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=ga0uldrL; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-82469-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82469-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id k130-20020a636f88000000b005d3f4474fddsi4466229pgc.167.2024.02.26.16.37.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 16:37:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82469-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=ga0uldrL; arc=pass (i=1 spf=pass spfdomain=sifive.com dkim=pass dkdomain=sifive.com dmarc=pass fromdomain=sifive.com); spf=pass (google.com: domain of linux-kernel+bounces-82469-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82469-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=sifive.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 026E3285359 for ; Tue, 27 Feb 2024 00:37:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4337D5C96; Tue, 27 Feb 2024 00:36:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b="ga0uldrL" Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com [209.85.210.42]) (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 206F181F for ; Tue, 27 Feb 2024 00:36:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708994196; cv=none; b=C0gsq+8jWBAC/0goWjjEfhk6mqRtWMeOejM3gnLToU3pogsZBCsedGWi4+IPHouUJKCtvzC8OqBxRWeSnYTzuJzWKuoOllQ5bVB0QRWzMsvYBocl89ONBHiSQj76TjvXo54uh7B8Wt/OvEyNVa3TEammOkxUb2z/bSwqRamhTRY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708994196; c=relaxed/simple; bh=sreB1pnRr5Jadz3cakW3nSmYitPedC09ULbGadTOM/M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WGhl9isyNBoJ0Foy6h1adSPYBmoC3ZW84X9FIyvpCWNUfuWlXBRyFvaxaSc8C1vTesj+/HU8sjI/BZZjnzNSA6RE33DwGEm7YFbhEpfT3olI3sjdbjNYjUnloUJ2lUs1+pFZ0XMkIq1Eg2x+MT0gvBSdJDAbfWv9E8XW0Qn0moQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com; spf=pass smtp.mailfrom=sifive.com; dkim=pass (2048-bit key) header.d=sifive.com header.i=@sifive.com header.b=ga0uldrL; arc=none smtp.client-ip=209.85.210.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=sifive.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sifive.com Received: by mail-ot1-f42.google.com with SMTP id 46e09a7af769-6e445b4f80bso2103474a34.0 for ; Mon, 26 Feb 2024 16:36:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; t=1708994194; x=1709598994; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7lRQpFKqbWbNQreMqz6Xcr3vDFL47RlEenB0ubeR/xU=; b=ga0uldrLkFlHSHnVwi2HJ3edK5EGl5iF+1lIPl0hKoXP0TLEqz97Jr4Q+V3RIPKiML sDJQ/CX7XPwEX8DqzXe/GYpHtCNkKPN2mVVqsPxASDqXdh7JVmnzcc7S0npy7DwQLOdZ CBJRPsSjz6Fgmx/3URexSBQT2YSN2UHhEy+uoeiIzv9m8kWMNeRqrjigxiVQelky188s Cuq+ZRz1Z4jyEloQ4X5AubWIwV7tSaDQY3EQndFEuUTbz4lWE4xHGi/BR0NffzVbFjBh 9yfRn29uoWSSb2c7RdBA80hEM2lmIROl5LU8Jiv8V7mvzeJAolyG6qIqXAiBYHOfnAYU B9qQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708994194; x=1709598994; 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=7lRQpFKqbWbNQreMqz6Xcr3vDFL47RlEenB0ubeR/xU=; b=UgEInj/WaU2oOaVI4d8h9rPAya0QXaBWcVpLJU0oPfA6cGuo6rlV8KbIUDssKASVew PTfs0pdtVXPZ3KTRBJUXVPzh8HLNYfiOXC+Qxh2BQT9XEaqjJ4AX+SOcvMHkmo552Mzu P3yFvdYwbqR4MpI5tp1zm0UU6QyENJmSs4oRMvmkxlhh2khXpE+a0YcLbFPDnnYbsYnh hgk/VNFFTWbgjUv9Tn+foeBnp8cbu/UnJHUw3qMSGdpxGN50c3tVBZcEajI30wDecFRH 0rbOmlApJnkPGmIy+nLEHzkRbOmnljdPINsKe4lA4HnFnfr07zWFNzXgSApRK32HoH1j PioQ== X-Gm-Message-State: AOJu0Yykw2/ogeov5tKJ72Hsx7XbFTBuANWg2fTF5uB/c3ocGTLX+QKH ZCvYNsLEvymZ1I8v+P/ecfq9ksSpecu5WcAB5HqK+vtOG58AeWuPb4zQ2Rk7Dgs= X-Received: by 2002:a9d:7845:0:b0:6e4:85d3:3e65 with SMTP id c5-20020a9d7845000000b006e485d33e65mr9808993otm.8.1708994194200; Mon, 26 Feb 2024 16:36:34 -0800 (PST) Received: from sw06.internal.sifive.com ([4.53.31.132]) by smtp.gmail.com with ESMTPSA id z25-20020a631919000000b005dc85821c80sm4504117pgl.12.2024.02.26.16.36.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 16:36:33 -0800 (PST) From: Samuel Holland To: Palmer Dabbelt , linux-riscv@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Samuel Holland Subject: [PATCH 1/4] riscv: Fix TASK_SIZE on 64-bit NOMMU Date: Mon, 26 Feb 2024 16:34:46 -0800 Message-ID: <20240227003630.3634533-2-samuel.holland@sifive.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240227003630.3634533-1-samuel.holland@sifive.com> References: <20240227003630.3634533-1-samuel.holland@sifive.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792010344504125053 X-GMAIL-MSGID: 1792010344504125053 On NOMMU, userspace memory can come from anywhere in physical RAM. The current definition of TASK_SIZE is wrong if any RAM exists above 4G, causing spurious failures in the userspace access routines. Fixes: 6bd33e1ece52 ("riscv: add nommu support") Fixes: c3f896dcf1e4 ("mm: switch the test_vmalloc module to use __vmalloc_node") Signed-off-by: Samuel Holland --- arch/riscv/include/asm/pgtable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h index 0c94260b5d0c..a564a39e5676 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) #define PAGE_SHARED __pgprot(0) #define PAGE_KERNEL __pgprot(0) #define swapper_pg_dir NULL -#define TASK_SIZE 0xffffffffUL +#define TASK_SIZE _AC(-1, UL) #define VMALLOC_START _AC(0, UL) #define VMALLOC_END TASK_SIZE