lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <890b1575-abab-4b3c-8953-110e1dd3f9ed@huawei.com>
Date: Wed, 27 Aug 2025 19:37:38 +0800
From: Quanmin Yan <yanquanmin1@...wei.com>
To: SeongJae Park <sj@...nel.org>
CC: <akpm@...ux-foundation.org>, <damon@...ts.linux.dev>,
	<linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>,
	<wangkefeng.wang@...wei.com>, <zuoze1@...wei.com>, <kernel-team@...a.com>,
	kernel test robot <lkp@...el.com>
Subject: Re: [PATCH v2 03/11] mm/damon/paddr: support addr_unit for
 DAMOS_PAGEOUT

Hi SJ,

在 2025/8/27 10:42, SeongJae Park 写道:
> On Wed, 27 Aug 2025 10:21:41 +0800 Quanmin Yan <yanquanmin1@...wei.com> wrote:
>
>> 在 2025/8/26 22:21, SeongJae Park 写道:
>>> On Tue, 26 Aug 2025 12:51:17 +0800 Quanmin Yan <yanquanmin1@...wei.com> wrote:
>>>
>>>> Hi SJ,
>>>>
>>>> 在 2025/8/26 11:21, SeongJae Park 写道:
>>>>> [...]
>>>>>
>>>>>>> ==== Attachment 0 (0001-mm-damon-paddr-use-do_div-on-i386-for-damon_pa_pageo.patch) ====
>>>>>>>     From hackermail Thu Jan  1 00:00:00 1970
>>>>>>> From: SeongJae Park <sj@...nel.org>
>>>>>>> To: Andrew Morton <akpm@...ux-foundation.org>
>>>>>>> Cc: SeongJae Park <sj@...nel.org>
>>>>>>> Cc: damon@...ts.linux.dev
>>>>>>> Cc: kernel-team@...a.com
>>>>>>> Cc: linux-kernel@...r.kernel.org
>>>>>>> Cc: linux-mm@...ck.org
>>>>>>> Date: Mon, 25 Aug 2025 07:41:33 -0700
>>>>>>> Subject: [PATCH 1/3] mm/damon/paddr: use do_div() on i386 for damon_pa_pageout()
>>>>>>>              return value
>>>>>>>
>>>>>>> Otherwise, __udidi3 linking problem happens on certain configs.
>>>>>>>
>>>>>>> Reported-by: kernel test robot <lkp@...el.com>
>>>>>>> Closes: https://lore.kernel.org/oe-kbuild-all/202508241831.EKwdwXZL-lkp@intel.com/
>>>>>>> Signed-off-by: SeongJae Park <sj@...nel.org>
>>>>>>> ---
>>>>>>>      mm/damon/paddr.c | 14 +++++++++++++-
>>>>>>>      1 file changed, 13 insertions(+), 1 deletion(-)
>>>>>>>
>>>>>>> diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
>>>>>>> index 5fad2f9a99a0..09c87583af6c 100644
>>>>>>> --- a/mm/damon/paddr.c
>>>>>>> +++ b/mm/damon/paddr.c
>>>>>>> @@ -135,6 +135,18 @@ static bool damon_pa_invalid_damos_folio(struct folio *folio, struct damos *s)
>>>>>>>      	return false;
>>>>>>>      }
>>>>>>>      
>>>>>>> +/* convert physical address to core-layer address */
>>>>>>> +static unsigned long damon_pa_core_addr(phys_addr_t pa,
>>>>>>> +		unsigned long addr_unit)
>>>>>>> +{
>>>>>>> +#ifdef __i386__
>>>>>> Can we use the following condition instead?
>>>>>>
>>>>>> #if !defined(CONFIG_64BIT) && defined(CONFIG_PHYS_ADDR_T_64BIT)
>>>>> To my understanding, this issue happens only on i386, not every 32bit
>>>>> architectures.  So I think i386 specific condition is better.
>>>> I understand. However, the aforementioned general condition is essential,
>>>> and we should propose a new patch to address this. After introducing addr_unit,
>>>> any 32-bit architecture should support monitoring of 64-bit phys_addr_t.
>>> The issue is that we cannot divide 64bit values with plain '/' operator on
>>> "i386", and hence this patch makes it to use do_div() instead of '/' on "i386".
>>> No such or other problems at supporting 64-bit phys_addr_t is found on other
>>> 32bit architectures, to my understanding.  My understanding is that at least
>>> you confirmed that on your arm-based test environment.  So we don't need a new
>>> patch to my understanding.
>>>
>>> Am I missing somthing?
>> This is because I seem to have made a mistake earlier: I adjusted the local
>> compilation toolchain. When the __udivdi3 issue mentioned above occurred, it
>> reminded me of a potential problem. After switching to a completely new environment
>> for testing, I discovered the __aeabi_uldivmod linking error in arm, which is similar
>> to the __udivdi3 issue.🙁
> Thank you for sharing this.  Then I agree the current fixup is insufficient.
>
> Andrew, could you please drop this patch series from mm tree for now?  I will
> further discuss with Quanmin about the proper fix and post next version of this
> series with the proper fixup.
>
>> To prevent similar environment-related problems in the
>> future, I suggest adjusting the condition to the following:
>>
>> #if !defined(CONFIG_64BIT) && defined(CONFIG_PHYS_ADDR_T_64BIT)
>>
>> Please consider approving this fix.
> I'm yet in travel, and I'd like to take more time on thinking about the proper
> fix.  Quanmin, could you share more details about your test setups, both for
> the compiling success case and failing case?

Apologies for disturbing you during your travels. Please allow me to explain:

When CONFIG_PHYS_ADDR_T_64BIT is enabled on "i386" [1], the phys_addr_t type
becomes 64-bit, requiring the use of the do_div function. We are in agreement
on this point.

On arm32, if LPAE (which we intend to support in this series) is enabled,
CONFIG_PHYS_ADDR_T_64BIT will also be enabled. In this case, pa / addr_unit
will involve 64-bit division and similarly require the do_div function.
Obviously, such link errors should normally occur under these circumstances.
Unfortunately, the expected anomalies did not manifest in my previous tests.
This may be related to some incorrect adjustments I had made to my local build
environment quite some time ago — though I cannot be entirely certain. That
said, I have since cleaned up the old configurations and ensured the current
environment is clean and normal. For now, we have confirmed the actual problem
and its root cause, shall we focus on fixing it?

In summary, after introducing addr_unit, we expect that any 32-bit architecture
should support monitoring of 64-bit phys_addr_t. Therefore, we can consider the
following adjustment:

#if !defined(CONFIG_64BIT) && defined(CONFIG_PHYS_ADDR_T_64BIT)

Or at least adjust it to:

#if defined(__i386__) || (defined(__arm__) && defined(CONFIG_PHYS_ADDR_T_64BIT))

I have thoroughly re-validated the feature functionality today and confirmed the
correctness of the aforementioned modifications. Therefore, could I kindly ask
you to consider the aforementioned modifications when you have some free time?

[1]https://download.01.org/0day-ci/archive/20250824/202508241831.EKwdwXZL-lkp@intel.com/config

Thanks,
Quanmin Yan

[...]


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ