Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 775095 - media-libs/mesa-20.3.4 requests kernel CONFIG_CHECKPOINT_RESTORE even on kernels with CONFIG_KCMP
Summary: media-libs/mesa-20.3.4 requests kernel CONFIG_CHECKPOINT_RESTORE even on kern...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-09 17:34 UTC by Dan Moulding
Modified: 2021-03-11 16:43 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Moulding 2021-03-09 17:34:38 UTC
To my knowledge, mesa has historically requested that the kernel have CONFIG_CHECKPOINT_RESTORE enabled because some mesa functions depend on the sys_kcmp system call. Traditionally, the only way to enable that syscall in Linux was to enable CONFIG_CHECKPOINT_RESTORE. However, since Linux v5.10.20 and v5.11.3, a new CONFIG_KCMP has been added to Linux to allow enabling sys_kcmp without having to enable CONFIG_CHECKPOINT_RESTORE (which enables a bunch of other usually unnecessary things otherwise not related to sys_kcmp).

When I emerged mesa-libs/mesa-20.3.4, on a system running Linux v5.11.5 with CONFIG_KCMP enabled, the mesa ebuild reported this:

     * Messages for package media-libs/mesa-20.3.4:

     *   CONFIG_CHECKPOINT_RESTORE:  is not set when it should be.
     * Please check to make sure these options are set correctly.
     * Failure to do so may cause unexpected problems.
    >>> Auto-cleaning packages...

Since I have CONFIG_KCMP enabled, mesa will get sys_kcmp and does not need CONFIG_CHECKPOINT_RESTORE enabled.

I suggest that the mesa ebuild should first check if CONFIG_KCMP is enabled (which it only can be on the newer kernels that support it), and recommend enabling CONFIG_KCMP if the config specifically says that CONFIG_KCMP is not set (which should only be found in configs for newer kernels), otherwise recommend enabling CONFIG_CHECKPOINT_RESTORE (for the older kernels that don't have CONFIG_KCMP).
Comment 1 Dan Moulding 2021-03-09 17:36:06 UTC
Here is the commit that introduced the change, creating a separate CONFIG_KCMP, in the linux-5.10.y branch:

commit 1ea36020950d44ef9152d832887a0c1cee0edee2
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Feb 5 22:00:12 2021 +0000

    kcmp: Support selection of SYS_kcmp without CHECKPOINT_RESTORE
    
    commit bfe3911a91047557eb0e620f95a370aee6a248c7 upstream.
    
    Userspace has discovered the functionality offered by SYS_kcmp and has
    started to depend upon it. In particular, Mesa uses SYS_kcmp for
    os_same_file_description() in order to identify when two fd (e.g. device
    or dmabuf) point to the same struct file. Since they depend on it for
    core functionality, lift SYS_kcmp out of the non-default
    CONFIG_CHECKPOINT_RESTORE into the selectable syscall category.
    
    Rasmus Villemoes also pointed out that systemd uses SYS_kcmp to
    deduplicate the per-service file descriptor store.
    
    Note that some distributions such as Ubuntu are already enabling
    CHECKPOINT_RESTORE in their configs and so, by extension, SYS_kcmp.
    
    References: https://gitlab.freedesktop.org/drm/intel/-/issues/3046
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Andy Lutomirski <luto@amacapital.net>
    Cc: Will Drewry <wad@chromium.org>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Dave Airlie <airlied@gmail.com>
    Cc: Daniel Vetter <daniel@ffwll.ch>
    Cc: Lucas Stach <l.stach@pengutronix.de>
    Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
    Cc: Cyrill Gorcunov <gorcunov@gmail.com>
    Cc: stable@vger.kernel.org
    Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch> # DRM depends on kcmp
    Acked-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> # systemd uses kcmp
    Reviewed-by: Cyrill Gorcunov <gorcunov@gmail.com>
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
    Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
    Link: https://patchwork.freedesktop.org/patch/msgid/20210205220012.1983-1-chris@chris-wilson.co.uk
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Comment 2 Matt Turner gentoo-dev 2021-03-11 16:42:52 UTC
Thanks...

So I found that the commit is in v5.12-rc1, v5.11.3, and v5.10.20. Irritating amount of logic to handle that. I hope it doesn't get backported further.
Comment 3 Larry the Git Cow gentoo-dev 2021-03-11 16:43:06 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de371306554b093d175fa9e12163b2e377d17762

commit de371306554b093d175fa9e12163b2e377d17762
Author:     Matt Turner <mattst88@gentoo.org>
AuthorDate: 2021-03-11 16:36:22 +0000
Commit:     Matt Turner <mattst88@gentoo.org>
CommitDate: 2021-03-11 16:38:00 +0000

    media-libs/mesa: Check for CONFIG_KCMP on appropriate kernel versions
    
    Closes: https://bugs.gentoo.org/775095
    Signed-off-by: Matt Turner <mattst88@gentoo.org>

 media-libs/mesa/mesa-20.3.4.ebuild     | 10 +++++++++-
 media-libs/mesa/mesa-21.0.0_rc5.ebuild | 12 ++++++++++--
 media-libs/mesa/mesa-9999.ebuild       | 12 ++++++++++--
 3 files changed, 29 insertions(+), 5 deletions(-)