[PATCH 1/8] drm/amd/display: Introduce KUnit tests for fixed31_32 library

David Gow davidgow at google.com
Thu Aug 11 07:19:23 UTC 2022


On Thu, Aug 11, 2022 at 11:05 AM 'Daniel Latypov' via KUnit
Development <kunit-dev at googlegroups.com> wrote:
>
> On Wed, Aug 10, 2022 at 5:40 PM Tales Aparecida
> <tales.aparecida at gmail.com> wrote:
> >
> > The fixed31_32 library performs a lot of the mathematical operations
> > involving fixed-point arithmetic and the conversion of integers to
> > fixed-point representation.
> >
> > This unit tests intend to assure the proper functioning of the basic
> > mathematical operations of fixed-point arithmetic, such as
> > multiplication, conversion from fractional to fixed-point number,
> > and more. Use kunit_tool to run:
> >
> > $ ./tools/testing/kunit/kunit.py run --arch=x86_64 \
> >         --kunitconfig=drivers/gpu/drm/amd/display/tests/
>
> Nice, thanks for including a kunitconfig, that'll help a lot.
>
> Just as an FYI: if you're working on top of torvalds/master, I think
> you would no longer need --arch=x86_64.
> Before, CONFIG_PCI=y was tricky to enable on UML, but commit
> 6fc3a8636a7b ("kunit: tool: Enable virtio/PCI by default on UML")
> landed for 6.0.
>
> I.e. I can run this command on torvalds/master w/ no other patches applied:
>
> $ ./tools/testing/kunit/kunit.py config --kunitconfig=/dev/stdin <<EOF
> CONFIG_KUNIT=y
> CONFIG_PCI=y
> CONFIG_DRM=y
> CONFIG_DRM_AMDGPU=y
> CONFIG_DRM_AMD_DC=y
> EOF
>
> I haven't tried to apply this series locally yet to double-check, but
> I'm pretty sure that means these tests should work as well.
> Running under UML would hopefully have faster compile times and be
> less resource heavy than a QEMU VM (but I've not measured to verify
> that).
>


There are still a few issues which prevent these tests from working on
UML I haven't had a chance to go through all of them yet, but I'll
drop a couple of quick responses to some of the individual patches.

The first thing to note is that amdgpu doesn't actually build on UML
at all without:
https://patchwork.kernel.org/project/linux-rdma/patch/20220218075727.2737623-3-davidgow@google.com/

IIRC, no-one liked spreading !defined(CONFIG_UML) everwhere. Replacing
it with IS_ENABLED(CONFIG_X86) also works, as X86_64 is defined on
UML, but X86 isn't.

The other issues are basically just other missing #ifdef checks or
dependencies. Plus there's a warning on my system even under x86_64
for integer overflow in the MIN_I64 definition.

Cheers,
-- David


More information about the amd-gfx mailing list