Hi Jian,
On Thu, Oct 29, 2020 at 06:13:07PM -0700, 'Jian Cai' via Clang Built Linux wrote:
> Thanks @Nick Desaulniers <ndesaulniers(a)google.com> and @Sasha Levin
> <sashal(a)kernel.org> for the tips. For this particular change, it seems we
> do not need to backport all the dependencies (if they have not been merged
> into 5.4 stable). @Greg KH <gregkh(a)linuxfoundation.org>, please find the
> custom backport as below. It has passed all the tests on ChromeOS (
> http://crrev.com/c/2504570).
>
> Thanks,
> Jian
The below patch won't apply because it appears to be copy pasted into
this message:
Applying: Backport 44623b2818f4a442726639572f44fd9b6d0ef68c to kernel 5.4
error: git diff header lacks filename information when removing 1 leading pathname component (line 6)
Patch failed at 0001 Backport 44623b2818f4a442726639572f44fd9b6d0ef68c to kernel 5.4
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
I would recommend resending the patch with git send-email or attaching
the patch file created by 'git format-patch -1' to a future email for
proper application.
> From 60891062750a39d8bba9710d500e381a26c11f75 Mon Sep 17 00:00:00 2001
> From: Jian Cai <jiancai(a)google.com>
> Date: Thu, 29 Oct 2020 17:49:39 -0700
Authorship and date should be fixed to retain the information of the
original commit.
It is trivial to just redo the cherry-pick to fix that information in
this instance but this is the command I usually run for more non-trivial
backports that I have already done:
$ git commit -s --amend -C <sha> --date "$(git show -s --format=%ai <sha>)"
This should allow you to retain the commit message of the original
message along with the author's date.
> Subject: [PATCH] crypto: x86/crc32c - fix building with clang ias
>
> commit 44623b2818f4a442726639572f44fd9b6d0ef68c upstream
>
> The clang integrated assembler complains about movzxw:
>
> arch/x86/crypto/crc32c-pcl-intel-asm_64.S:173:2: error: invalid instruction
> mnemonic 'movzxw'
>
> It seems that movzwq is the mnemonic that it expects instead,
> and this is what objdump prints when disassembling the file.
>
> NOTE: this is a custom backport as the surrounding code has been
> changed upstream.
A note of this nature is traditionally placed after the signoffs of the
original patch like my example below:
> Fixes: 6a8ce1ef3940 ("crypto: crc32c - Optimize CRC32C calculation with
> PCLMULQDQ instruction")
> Signed-off-by: Arnd Bergmann <arnd(a)arndb.de>
> Reviewed-by: Nathan Chancellor <natechancellor(a)gmail.com>
> Signed-off-by: Herbert Xu <herbert(a)gondor.apana.org.au>
[jc: Backport to 5.4]
> Signed-off-by: Jian Cai <caij2003(a)gmail.com>
I usually like to notate why the patch did not apply cleanly so that it
is easier for others to audit, such as:
[jc: Fixed conflicts due to lack of 34fdce6981b969]
That is merely a suggestion, not required by any means.
Otherwise, the backport seems obvious fine to me.
Cheers,
Nathan
> ---
> arch/x86/crypto/crc32c-pcl-intel-asm_64.S | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
> b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
> index d9b734d0c8cc..3c6e01520a97 100644
> --- a/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
> +++ b/arch/x86/crypto/crc32c-pcl-intel-asm_64.S
> @@ -170,7 +170,7 @@ continue_block:
>
> ## branch into array
> lea jump_table(%rip), bufp
> - movzxw (bufp, %rax, 2), len
> + movzwq (bufp, %rax, 2), len
> lea crc_array(%rip), bufp
> lea (bufp, len, 1), bufp
> JMP_NOSPEC bufp
> --
> 2.29.1.341.ge80a0c044ae-goog
On 29 Oct 2020, at 17:14, Yang Shi wrote:
> On Thu, Oct 29, 2020 at 1:04 PM Zi Yan <zi.yan(a)sent.com> wrote:
>>
>> From: Zi Yan <ziy(a)nvidia.com>
>>
>> In isolate_migratepages_block, when cc->alloc_contig is true, we are
>> able to isolate compound pages, nr_migratepages and nr_isolated did not
>> count compound pages correctly, causing us to isolate more pages than we
>> thought. Use thp_nr_pages to count pages. Otherwise, we might be trapped
>> in too_many_isolated while loop, since the actual isolated pages can go
>> up to COMPACT_CLUSTER_MAX*512=16384, where COMPACT_CLUSTER_MAX is 32,
>
> Is it that easy to run into? 16384 doesn't seem like too many pages, just 64MB.
I hit this when I was running oom01 from ltp to test my PUD THP patchset, which
allocates PUD THPs from CMA regions and splits them into PMD THPs due to memory
pressure. I am not sure if it is common that in the upstream kernel PMD THPs will
be allocated in CMA regions due to allocation fallback.
>
>> since we stop isolation after cc->nr_migratepages reaches to
>> COMPACT_CLUSTER_MAX.
>>
>> In addition, after we fix the issue above, cc->nr_migratepages could
>> never be equal to COMPACT_CLUSTER_MAX if compound pages are isolated,
>> thus page isolation could not stop as we intended. Change the isolation
>> stop condition to >=.
>
> The fix looks sane to me. Reviewed-by: Yang Shi <shy828301(a)gmail.com>
Thanks.
>
> Shall you add Fixes tag to commit
> 1da2f328fa643bd72197dfed0c655148af31e4eb? And may cc stable.
Sure.
Fixes: 1da2f328fa64 (“mm,thp,compaction,cma: allow THP migration for CMA allocations”)
stable cc’ed.
>
>>
>> Signed-off-by: Zi Yan <ziy(a)nvidia.com>
>> ---
>> mm/compaction.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/mm/compaction.c b/mm/compaction.c
>> index ee1f8439369e..0683a4999581 100644
>> --- a/mm/compaction.c
>> +++ b/mm/compaction.c
>> @@ -1012,8 +1012,8 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
>>
>> isolate_success:
>> list_add(&page->lru, &cc->migratepages);
>> - cc->nr_migratepages++;
>> - nr_isolated++;
>> + cc->nr_migratepages += thp_nr_pages(page);
>> + nr_isolated += thp_nr_pages(page);
>>
>> /*
>> * Avoid isolating too much unless this block is being
>> @@ -1021,7 +1021,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn,
>> * or a lock is contended. For contention, isolate quickly to
>> * potentially remove one source of contention.
>> */
>> - if (cc->nr_migratepages == COMPACT_CLUSTER_MAX &&
>> + if (cc->nr_migratepages >= COMPACT_CLUSTER_MAX &&
>> !cc->rescan && !cc->contended) {
>> ++low_pfn;
>> break;
>> @@ -1132,7 +1132,7 @@ isolate_migratepages_range(struct compact_control *cc, unsigned long start_pfn,
>> if (!pfn)
>> break;
>>
>> - if (cc->nr_migratepages == COMPACT_CLUSTER_MAX)
>> + if (cc->nr_migratepages >= COMPACT_CLUSTER_MAX)
>> break;
>> }
>>
>> --
>> 2.28.0
>>
>>
—
Best Regards,
Yan Zi
On Mon, Oct 26, 2020 at 06:17:00PM -0700, Jian Cai wrote:
> Hello,
>
> I am working on assembling kernel 5.4 with LLVM's integrated assembler on
> ChromeOS, and the following patch is required to make it work. Would you
> please consider backporting it to 5.4?
>
>
> commit 44623b2818f4a442726639572f44fd9b6d0ef68c
> Author: Arnd Bergmann <arnd(a)arndb.de>
> Date: Wed May 27 16:17:40 2020 +0200
>
> crypto: x86/crc32c - fix building with clang ias
>
> Link:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?…
>
It does not apply cleanly, can you please provide a properly backported
and tested version?
thanks,
greg k-h