Bug 289611 - dns/knot3: Fix build error by CPU optimizing
Summary: dns/knot3: Fix build error by CPU optimizing
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Vladimir Druzenko
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-09-14 22:13 UTC by Norikatsu Shigemura
Modified: 2025-12-02 19:29 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (freebsd)


Attachments
files/patch-src_knot_modules_rrl_kru-avx2.c (1.51 KB, patch)
2025-09-14 22:13 UTC, Norikatsu Shigemura
no flags Details | Diff
files/patch-src_knot_modules_rrl_kru-avx2.c (1.51 KB, patch)
2025-11-16 00:54 UTC, Mark Linimon
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Norikatsu Shigemura freebsd_committer freebsd_triage 2025-09-14 22:13:10 UTC
Created attachment 263802 [details]
files/patch-src_knot_modules_rrl_kru-avx2.c

There is an issue with the Knot3 build that is not optimized properly on SandyBridge and later CPUs.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
In file included from knot/modules/rrl/kru-avx2.c:43:
knot/modules/rrl/./kru.inc.c:250:7: error: always_inline function '_mm_load_si128' requires target feature 'pclmul', but would be inlined into function 'kru_limited_prefetch' that is compiled without support for 'pclmul'
  250 |                 h = _mm_load_si128((__m128i *)key);
      |                     ^
  :
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
*** [knot/modules/rrl/libknotd_la-kru-avx2.lo] Error code 1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

If you are targeting IceLake and/or later CPUs, there is a problem with the following code:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#pragma clang attribute push (__attribute__((target("arch=x86-64-v3,aes"))),
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
The pragma is missing, so you need to add it as follows:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#pragma clang attribute push (__attribute__((target("arch=x86-64-v4,aes,pclmul,adx,rdseed,rdrnd,prfchw,xsaveopt,xsaves,avx512vnni,pku,clwb,fsgsbase,clflushopt,invpcid,xsavec"))), apply_to = function)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OR simplefully,
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#pragma clang attribute push (__attribute__((target("arch=icelake-client"))), apply_to = function)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

I think that it just seems like unnecessary code, at least on FreeBSD.
Comment 1 Norikatsu Shigemura freebsd_committer freebsd_triage 2025-09-15 22:45:39 UTC
FYI: You can reproduce this issue using the following method:

cd /usr/ports/dns/knot3
make CPUTYPE=               : OK (default)
make CPUTYPE=nehalem        : OK
make CPUTYPE=sandybridge    : NG
make CPUTYPE=haswell        : NG
make CPUTYPE=skylake        : NG
make CPUTYPE=cascadelake    : NG
make CPUTYPE=icelake-client : NG
Comment 2 Leo Vandewoestijne 2025-10-01 07:46:25 UTC
I comprehend the problem, not the code.
What's wisedom? Simply apply this patch and report upstream?
Comment 3 Leo Vandewoestijne 2025-10-22 14:20:04 UTC
Reported upstream:
https://gitlab.nic.cz/knot/knot-dns/-/merge_requests/1815
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2025-11-16 00:54:48 UTC
Created attachment 265442 [details]
files/patch-src_knot_modules_rrl_kru-avx2.c

^Triage: rename the patch so that it will apply correctly.
Comment 5 Leo Vandewoestijne 2025-12-02 10:44:52 UTC
(In reply to Norikatsu Shigemura from comment #0)
Issue was reported, and addressed upstream.
PR 291264 absoletes this PR.
Comment 6 commit-hook freebsd_committer freebsd_triage 2025-12-02 19:26:32 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=be60b49d5a9bcfd93dcc3a39a3d68f0aef7a9a06

commit be60b49d5a9bcfd93dcc3a39a3d68f0aef7a9a06
Author:     Einar Bjarni Halldórsson <einar@isnic.is>
AuthorDate: 2025-12-02 19:22:27 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2025-12-02 19:25:12 +0000

    dns/{knot3,py-libknot}: Update 3.5.0 => 3.5.2

    Changelog:
    https://gitlab.nic.cz/knot/knot-dns/raw/v3.5.2/NEWS

    PR:             291264 289611
    Approved by:    Leo Vandewoestijne <freebsd@dns.company> (maintainer)
    MFH:            2025Q4

 dns/knot3/distinfo            | 6 +++---
 dns/knot3/distinfo.py-libknot | 6 +++---
 dns/knot3/knotdns.mk          | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)
Comment 7 commit-hook freebsd_committer freebsd_triage 2025-12-02 19:28:33 UTC
A commit in branch 2025Q4 references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=9f15b6057785567ea4537cebce88dd52810c9ed4

commit 9f15b6057785567ea4537cebce88dd52810c9ed4
Author:     Einar Bjarni Halldórsson <einar@isnic.is>
AuthorDate: 2025-12-02 19:22:27 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2025-12-02 19:27:23 +0000

    dns/{knot3,py-libknot}: Update 3.5.0 => 3.5.2

    Changelog:
    https://gitlab.nic.cz/knot/knot-dns/raw/v3.5.2/NEWS

    PR:             291264 289611
    Approved by:    Leo Vandewoestijne <freebsd@dns.company> (maintainer)
    MFH:            2025Q4

    (cherry picked from commit be60b49d5a9bcfd93dcc3a39a3d68f0aef7a9a06)

 dns/knot3/distinfo            | 6 +++---
 dns/knot3/distinfo.py-libknot | 6 +++---
 dns/knot3/knotdns.mk          | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)