Message ID | 20240228085824.74639-1-dawei.li@shingroup.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-84731-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp3223182dyb; Wed, 28 Feb 2024 01:06:53 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX5vo1t6l9nfjkKhVuSn8RvO00Je7cZ0EFvWPkDUTDVMs+bbGEH4JA8zCXiVsSjtxA6TkxjviLccssfwM+S+N6TntLw9g== X-Google-Smtp-Source: AGHT+IEwJSFgRjNWK1kCokkCa2xdkT8V7StSSskrRY/GDpmnzdTyVSs26oWzEtbtyNgIAGrmf25U X-Received: by 2002:a17:906:6d45:b0:a43:4c0a:5360 with SMTP id a5-20020a1709066d4500b00a434c0a5360mr5407463ejt.32.1709111213328; Wed, 28 Feb 2024 01:06:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709111213; cv=pass; d=google.com; s=arc-20160816; b=w27fgKKCGfXsG13XbhYGcWzVe0pSYcAUnQX3fvb9xvJTJw8XbwTwewffQhIl5Llh/Z KAIaNa/Pen4TDYvRiARTuovvHsRQH0TsjhKEYfWYJU9/YjfWzORYAKaINnbTxinhgEwT PsQ65imY6uHDicBj5pE2sIkiXKRqCzSLhgScfamKcoiXXKx1ggQiBGrXh50akIpKIhSW wS8X1qd4vN1gFpAPAW0kGLtUuzWLDIaxzxIBghl0a9XVVIAr5nagyyN8O55j+dXKdSo/ ZYeFH5UMWYtsQlcM/prFDnT6XZHVs1WcUGWZGLFL4RlrjiUDagwqwxpmfqfpXIYoa7xx gr3Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=feedback-id:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=4BVGm6lc9Ts68lPXPioUCBGEuIvUiucJPRklARmb5Ss=; fh=NmHZ4Rea6QE97xBSdUJ/a1kvWYSDqLqzQisPSZ7Jawo=; b=O6uNohj4qF4FKuEOvyPLrtPGfQc+iWIgeT9dotF4DGpTO9/5QR9kzbxcPl1B4vHkwE umsX9foRPYa7Lmstcyr2IZADLwYGOXDssUN2Xsj+LNphtQ98FqOyycM8wPVflyB1yuaw M4f6sZYYxxlQR5vVoFLPKtMyifbeg7IBlWmcH5MSgqh6Uwo03dresMApEtpPIz0it2Wg K36cMITef99hcHnSkhxPTiPwWsOb36Ln5ck6rdxwO3DwqbHdHWddLouJgfUQirqQ1yok XmwiAjMYQRiVYaFpu4ZsLbDEi99CK5iTDDh5hI9cumnsFefkxI6QZdDoa7jgxMdd20dj P6qw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=shingroup.cn dmarc=pass fromdomain=shingroup.cn); spf=pass (google.com: domain of linux-kernel+bounces-84731-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84731-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=shingroup.cn Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id o26-20020a17090611da00b00a439ab2bbb9si1547893eja.284.2024.02.28.01.06.53 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Feb 2024 01:06:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-84731-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=shingroup.cn dmarc=pass fromdomain=shingroup.cn); spf=pass (google.com: domain of linux-kernel+bounces-84731-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-84731-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=shingroup.cn 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 EAE4A1F222C4 for <ouuuleilei@gmail.com>; Wed, 28 Feb 2024 09:06:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 273FF481B2; Wed, 28 Feb 2024 09:02:35 +0000 (UTC) Received: from bg1.exmail.qq.com (bg1.exmail.qq.com [114.132.62.65]) (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 C2DAE381C2; Wed, 28 Feb 2024 09:02:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=114.132.62.65 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709110953; cv=none; b=Zf3FCIxYEEefODx2o81slGf4bFVqSNlHY7ihqLNQ/oYHJRXwzR2rYKFCxhF/dTNWI6dSIdvgyTk2ig0OFxfBpkI66e3Hw1vnv3S44llCCDuNJp1B8KUtN/cOUJvZK1dJZDZxG46zY9W6Ei5vgWxN3GjLzHJ/O7LFdMZWo1ys9io= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709110953; c=relaxed/simple; bh=RDvcBlVuIemwLM4J03ulD1eFMdgG9/KmMg5CARU8pQI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=fuMiVE9NmNtXgVT/hAbQJQWdbGcxds2oYoDbLsOdfuIA4RwdMAc6joT8ZOG1dNK4c9gXeYM5uJB965FSY9+vAqp4zGoGx2GPTt4q4PtnR/vC9u+xts3NZ6ZqBXWlgSqh5mJ5QtJmB1zmNesQQbiOOpqik7P0S1K0mL0byI15DbA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=shingroup.cn; spf=pass smtp.mailfrom=shingroup.cn; arc=none smtp.client-ip=114.132.62.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=shingroup.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=shingroup.cn X-QQ-mid: bizesmtp81t1709110713tb5brp7v X-QQ-Originating-IP: RMFuvulrkTTkIP3veOx5DZWOUzbPAQR7RNVNIZjsZAQ= Received: from localhost ( [112.22.30.30]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 28 Feb 2024 16:58:32 +0800 (CST) X-QQ-SSF: 01400000000000505000000F0000000 X-QQ-FEAT: LE7C6P2vL8S2AsPvDMxMsvXF+uR7nFYwkxu3h1ZViKpA2gYns/FH84WdcCO1m A9y5Xklv7vi7WpLi05dx2fTfkPNHUtslCmUkh8VaAlXr/Mii1L24lZiIeEU9GgBwu6ELmCG Yp5eXgQrWF0h58L+WEaKuboRvZ+2LRlqIodEp8+BtmTqkafTgd/TXC3agtGlM2GfwTrERLM OoIyX6cYvGPkf4DuxsRzACF2+g97DyrnC61htmVfL15IU/w8GA4ePV9H1ypPGpUnAKbdP9h /Bx1Ls+WojIKWMFGG6YA+C38tNgymkK3XcUJ4pssb6XWERXJDQpD1ywHAjw15wnTcZoMrpk FRvfTz+5rwdZWgxsF95DFA4zg4XfU82GpMYXCgUVZGshWi8imujDYYXN0Jwn1dIXCKOlJDt X-QQ-GoodBg: 2 X-BIZMAIL-ID: 16178612125370400260 From: Dawei Li <dawei.li@shingroup.cn> To: geert@linux-m68k.org Cc: gerg@snapgear.com, linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org, set_pte_at@outlook.com, Dawei Li <dawei.li@shingroup.cn>, stable@vger.kernel.org Subject: [PATCH] mk68k: Fix broken THREAD_SIZE_ORDER Date: Wed, 28 Feb 2024 16:58:24 +0800 Message-Id: <20240228085824.74639-1-dawei.li@shingroup.cn> X-Mailer: git-send-email 2.27.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:shingroup.cn:qybglogicsvrgz:qybglogicsvrgz5a-1 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792132999824060094 X-GMAIL-MSGID: 1792132999824060094 |
Series |
mk68k: Fix broken THREAD_SIZE_ORDER
|
|
Commit Message
Dawei Li
Feb. 28, 2024, 8:58 a.m. UTC
Current THREAD_SIZE_ORDER implementation for m68k is incorrect, fix it
by ilog2().
Fixes: cddafa3500fd ("m68k/m68knommu: merge MMU and non-MMU thread_info.h")
Signed-off-by: Dawei Li <dawei.li@shingroup.cn>
Cc: stable@vger.kernel.org
---
arch/m68k/include/asm/thread_info.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
Comments
On 28. 02. 24, 9:58, Dawei Li wrote: > Current THREAD_SIZE_ORDER implementation for m68k is incorrect, fix it > by ilog2(). This is not a good commit log. Incorrect in what way and why is the fixed version correct? And what is affected? Note you're referring to a change which was done 14 years ago. It definitely must not be that incorrect (for everybody). > Fixes: cddafa3500fd ("m68k/m68knommu: merge MMU and non-MMU thread_info.h") > Signed-off-by: Dawei Li <dawei.li@shingroup.cn> > Cc: stable@vger.kernel.org > --- > arch/m68k/include/asm/thread_info.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/arch/m68k/include/asm/thread_info.h b/arch/m68k/include/asm/thread_info.h > index 31be2ad999ca..50faecd6fc5f 100644 > --- a/arch/m68k/include/asm/thread_info.h > +++ b/arch/m68k/include/asm/thread_info.h > @@ -19,7 +19,8 @@ > #else > #define THREAD_SIZE PAGE_SIZE > #endif > -#define THREAD_SIZE_ORDER ((THREAD_SIZE / PAGE_SIZE) - 1) > + > +#define THREAD_SIZE_ORDER ilog2(THREAD_SIZE / PAGE_SIZE) > > #ifndef __ASSEMBLY__ >
Hi Jiri, Thanks for quick review. On Wed, Feb 28, 2024 at 10:11:05AM +0100, Jiri Slaby wrote: > On 28. 02. 24, 9:58, Dawei Li wrote: > > Current THREAD_SIZE_ORDER implementation for m68k is incorrect, fix it > > by ilog2(). > > This is not a good commit log. Incorrect in what way and why is the fixed Agreed. > version correct? And what is affected? Note you're referring to a change > which was done 14 years ago. It definitely must not be that incorrect (for > everybody). It's 'right' just for current PAGE_SIZE & THREAD_SIZE configs: // arch/m68k/include/asm/thread_info.h #if PAGE_SHIFT < 13 #ifdef CONFIG_4KSTACKS #define THREAD_SIZE 4096 #else #define THREAD_SIZE 8192 #endif #else #define THREAD_SIZE PAGE_SIZE #endif #define THREAD_SIZE_ORDER ((THREAD_SIZE / PAGE_SIZE) - 1) // arch/m68k/include/asm/page.h #if defined(CONFIG_SUN3) || defined(CONFIG_COLDFIRE) #define PAGE_SHIFT 13 #else #define PAGE_SHIFT 12 #endif #define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) #define PAGE_MASK (~(PAGE_SIZE-1)) #define PAGE_OFFSET (PAGE_OFFSET_RAW) But it's incorrect in generic/mathematical way. Thanks, Dawei > > > Fixes: cddafa3500fd ("m68k/m68knommu: merge MMU and non-MMU thread_info.h") > > Signed-off-by: Dawei Li <dawei.li@shingroup.cn> > > Cc: stable@vger.kernel.org > > --- > > arch/m68k/include/asm/thread_info.h | 3 ++- > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > diff --git a/arch/m68k/include/asm/thread_info.h b/arch/m68k/include/asm/thread_info.h > > index 31be2ad999ca..50faecd6fc5f 100644 > > --- a/arch/m68k/include/asm/thread_info.h > > +++ b/arch/m68k/include/asm/thread_info.h > > @@ -19,7 +19,8 @@ > > #else > > #define THREAD_SIZE PAGE_SIZE > > #endif > > -#define THREAD_SIZE_ORDER ((THREAD_SIZE / PAGE_SIZE) - 1) > > + > > +#define THREAD_SIZE_ORDER ilog2(THREAD_SIZE / PAGE_SIZE) > > #ifndef __ASSEMBLY__ > > -- > js > suse labs > >
Hi Dawei, On Wed, Feb 28, 2024 at 10:34 AM Dawei Li <dawei.li@shingroup.cn> wrote: > On Wed, Feb 28, 2024 at 10:11:05AM +0100, Jiri Slaby wrote: > > On 28. 02. 24, 9:58, Dawei Li wrote: > > > Current THREAD_SIZE_ORDER implementation for m68k is incorrect, fix it > > > by ilog2(). > > > > This is not a good commit log. Incorrect in what way and why is the fixed > > Agreed. > > > version correct? And what is affected? Note you're referring to a change > > which was done 14 years ago. It definitely must not be that incorrect (for > > everybody). > > It's 'right' just for current PAGE_SIZE & THREAD_SIZE configs: > > // arch/m68k/include/asm/thread_info.h > #if PAGE_SHIFT < 13 > #ifdef CONFIG_4KSTACKS > #define THREAD_SIZE 4096 > #else > #define THREAD_SIZE 8192 > #endif > #else > #define THREAD_SIZE PAGE_SIZE > #endif > #define THREAD_SIZE_ORDER ((THREAD_SIZE / PAGE_SIZE) - 1) Indeed. The only supported values for THREAD_SIZE_ORDER on m68k are 0 and 1. > But it's incorrect in generic/mathematical way. True. But does it matter much? I.e. do you plan to add support for larger values of THREAD_SIZE? What about changing the #ifdeffery to set THREAD_SIZE_ORDER to an explicit value, and calculating THREAD_SIZE from THREAD_SIZE_ORDER instead? Gr{oetje,eeting}s, Geert
diff --git a/arch/m68k/include/asm/thread_info.h b/arch/m68k/include/asm/thread_info.h index 31be2ad999ca..50faecd6fc5f 100644 --- a/arch/m68k/include/asm/thread_info.h +++ b/arch/m68k/include/asm/thread_info.h @@ -19,7 +19,8 @@ #else #define THREAD_SIZE PAGE_SIZE #endif -#define THREAD_SIZE_ORDER ((THREAD_SIZE / PAGE_SIZE) - 1) + +#define THREAD_SIZE_ORDER ilog2(THREAD_SIZE / PAGE_SIZE) #ifndef __ASSEMBLY__