# Xorg server segfault



## YuryG (Dec 12, 2022)

Well, after a try of upgrade, I get segfault when I start Xorg ("signal 11"). How can I trace the error causing it? I'm on 12-stable with an old radeon integrated card (HD3200 or HD3000). It used to work previously. Rebuilt xorg-server and its dependencies a dozen of times in different order without luck.
fb terminal driver switches video mode, and radeon kld modules are loaded.


----------



## Alain De Vos (Dec 12, 2022)

what's the output of:

```
freebsd-version -kru
```


----------



## YuryG (Dec 12, 2022)

Alain De Vos said:


> what's the output of:
> 
> ```
> freebsd-version -kru
> ```


12.4-STABLE
12.4-STABLE
12.4-STABLE


----------



## Alain De Vos (Dec 12, 2022)

In rc.conf:

```
kld_list="drm radeonkms"
```
Install:

```
pkg install gpu-firmware-kmod
```
xorg.conf something like,

```
cat xorg.conf 
Section "Device"
    Identifier "Card0"
    BusID "PC:X:Y:Z"
    Screen 0
EndSection

Section "Screen"
    Identifier "Screen0"
    Device       "Card0"
    Monitor    "Monitor0"
    SubSection "Display"
    EndSubSection
EndSection
```


----------



## YuryG (Dec 14, 2022)

Alain De Vos said:


> In rc.conf:
> 
> ```
> kld_list="drm radeonkms"
> ```


Thank you! I had "/boot/modules/radeonkms.ko" in rc.conf from previous version, but somehow it loaded wrong module, changing it to "radeonkms" happen to solve my problem.
(I wonder why we need different radeonkms.ko in the system?)


----------



## Alain De Vos (Dec 14, 2022)

Don't know.


----------



## Erichans (Dec 14, 2022)

YuryG said:


> Thank you! I had "/boot/modules/radeonkms.ko" in rc.conf from previous version, but somehow it loaded wrong module, changing it to "radeonkms" happen to solve my problem.
> (I wonder why we need different radeonkms.ko in the system?)


It probably has something to do with the changed driver support in graphics/drm-510-kmod (or the meta port graphics/drm-kmod that pulls it in). There has been a fairly recent update in drivers as announced here.

Looking at List of AMD graphics processing units,  graphics/drm-510-kmod states:

```
pkg-message:
    For install:
        The drm-510-kmod port can be enabled for amdgpu (for AMD
        GPUs starting with the HD7000 series / Tahiti)
```
That, in all likelyhood means that your "old radeon integrated card (HD3200 or HD3000)" is not supported anymore by the radeonkms driver in that updated package/port (=graphics/drm-510-kmod). I suspect when just specifying `kld_list="drm radeonkms"` you'll get "the old radeonkms" driver belonging to the base (in your case 12-STABLE) that (still) does support your HD3200 or HD3000.

Specified* in  in /etc/rc.conf:

`kld_list="drm radeonkms"` should load /boot/kernel/radeonkms.ko
`kld_list="/boot/modules/radeonkms.ko"` should load /boot/modules/radeonkms.ko
To check after booting which kernel module actually has been loaded use `kldstat -vn radeonkms.ko`

When the driver /boot/kernel/radeonkms.ko will eventually be replaced by a more recent one that stops supporting your "old radeon integrated card (HD3200 or HD3000)", you'll have to search for an appropriate legacy port.

I'm on 12.4-RELEASE and have the most recent graphics/drm-kmod from the "latest repository"; I have two different radeonkms.ko files:

```
-r-xr-xr-x  1 root  wheel  1477160 Dec  7 02:49 /boot/kernel/radeonkms.ko*
-r-xr-xr-x  1 root  wheel  2450624 Sep 20 03:28 /boot/modules/radeonkms.ko*
```

___
* you can omit specifying "drm" because this module is autoloaded by the loader when loading radeonkms.ko


----------



## YuryG (Dec 15, 2022)

Erichans said:


> It probably has something to do with the changed driver support in graphics/drm-510-kmod (or the meta port graphics/drm-kmod that pulls it in). There has been a fairly recent update in drivers as announced here.
> 
> Looking at List of AMD graphics processing units,  graphics/drm-510-kmod states:
> 
> ...


radeonkms is the legacy driver, isn't it? For newer AMD GPUs we have amdgpu.
Also your radeonkms.ko from kernel subdirectory is newer than from modules one. Have you had upgraded kernel more recently than ports?
And graphics/drm-510-kmod is for FreeBSD-13+, not for 12.4, as I can see, for the latter there's graphics/drm-fbsd12.0-kmod.


----------



## Erichans (Dec 15, 2022)

YuryG said:


> radeonkms is the legacy driver, isn't it? For newer AMD GPUs we have amdgpu.
> Also your radeonkms.ko from kernel subdirectory is newer than from modules one. Have you had upgraded kernel more recently than ports?
> And graphics/drm-510-kmod is for FreeBSD-13+, not for 12.4, as I can see, for the latter there's graphics/drm-fbsd12.0-kmod.


Yeah, I mixed that up, graphics/drm-fbsd12.0-kmod is for FreeBSD 12. I have recently upgraded to 12.4-RELEASE and after that did a pkg update & upgrade.

I don't have any radeon graphics myself, so you have the "practical advantage". graphics/drm-fbsd12.0-kmod also states:

```
pkg-message:
    For install:
        The drm-fbsd12.0-kmod port can be enabled for amdgpu (for AMD GPUs starting
        with the HD7000 series / Tahiti)
```
You are right that radeonkms is quite old and could very well be labelled as legacy, however the whole package/port that contains it is not labelled as legacy. Because HD3000 & HD3200 is so old is probably the reason that it is no longer incorporated in either graphics/drm-fbsd12.0-kmod or graphics/drm-510-kmod. After a search I cannot find any other package/port that mentions support for your graphics—I may have ovelooked something.

So far the base of FreeBSD 12 supports your graphics. Consider testing FreeBSD 13 before you need it to check if it still supports your radeon graphics.


----------



## SirDice (Dec 16, 2022)

Erichans said:


> So far the base of FreeBSD 12 supports your graphics. Consider testing FreeBSD 13 before you need it to check if it still supports your radeon graphics.


Note that the 'old' radeonkms.ko that came with the base on 12.x doesn't exist anymore in 13.x. It's been removed from the base completely.


----------



## Alain De Vos (Dec 16, 2022)

pkg which /boot/modules/radeonkms.ko

```
/boot/modules/radeonkms.ko was installed by package drm-510-kmod-5.10.113_7
```


----------



## bsosenba (Dec 21, 2022)

So, I'm on 13.1-RELEASE with an AMD Radeon HD 5450 (Evergreen / Cedar) and am having the same issues. Yes, I have graphics/gpu-firmware-kmod and graphics/drm-510-kmod installed; and yes, my /etc/rc.conf has `kld_list="drm radeonkms"`

According to the wiki, my graphics card should be supported; although I bet that's for the "old" radeonkms.ko

I'm still a (relatively) new user. How do I go about finding a legacy port that would support my graphics card?


----------



## cracauer@ (Dec 21, 2022)

As root when no X11 server is running yet:


```
lldb /usr/local/libexec/Xorg
r
[wait for segfault]
bt
```


----------



## Erichans (Dec 21, 2022)

bsosenba said:


> So, I'm on 13.1-RELEASE with an AMD Radeon HD 5450 (Evergreen / Cedar) and am having the same issues. Yes, I have graphics/gpu-firmware-kmod and graphics/drm-510-kmod installed; and yes, my /etc/rc.conf has `kld_list="drm radeonkms"`
> 
> According to the wiki, my graphics card should be supported; although I bet that's for the "old" radeonkms.ko
> 
> I'm still a (relatively) new user. How do I go about finding a legacy port that would support my graphics card?


Your AMD Radeon HD 5450 is probably not supported on 13.1 but let's check a few things first. Please give the output of
`ls -l /boot/kernel/radeonkms.ko /boot/modules/radeonkms.ko` 
`kldstat -vn radeonkms.ko`
`pkg which /boot/modules/radeonkms.ko`


----------



## bsosenba (Dec 22, 2022)

So apparently I have bigger issues to resolve first. Somehow I'm still on the 13.1-p2 kernel with the p5 patches. I'll upgrade and see if that helps things


----------



## zirias@ (Dec 22, 2022)

YuryG mesa packages were updated to 22.3 on December 1st, and this introduced an (upstream) bug which would cause segfaults for ati/radeon cards using the `r600_dri.so` driver. This was just recently solved in PR 268327. So, could you try updating again and report back please?


----------



## bsosenba (Dec 22, 2022)

Okay, so `freebsd-version -kru` reports

```
13.1-RELEASE-p3
13.1-RELEASE-p3
13.1-RELEASE-p5
```
, and `ls -l` reports that /boot/kernel/radeonkms.ko is missing while /boot/modules/radeonkms.ko exists and is owned by root and the wheel group. `kldstat -vn` reports that /boot/modules/radeonkms.ko is loaded, and `pkg which` says that it was installed by graphics/drm-510-kmod version 5.10.113_8

So long story short, somehow I have /boot/modules/radeonkms.ko installed and loaded instead of /boot/kernel/radeonkms.ko[/CMD]


----------



## bsosenba (Dec 22, 2022)

I also just tried pointing /etc/rc.conf to /boot/modules/radeonkms.ko (didn't work) and then manually copying /boot/modules/radeonkms.ko to /boot/kernel (didn't work either)


----------



## Erichans (Dec 22, 2022)

You got FreeBSD 13.1 up to date. Your other output confirms that the loaded radeonkms.ko is from the package graphics/drm510-kmod; this is as expected because /boot/modules/radeonkms.ko is in the loader's search path as indicated by `sysctl kern.module_path`

The absence of /boot/kernel/radeonkms.ko means that support _in the FreeBSD base system_ for the radeonkms driver has been removed as SirDice noted earlier here. Your driver /boot/modules/radeonkms.ko supports _some_ older radeon based graphics cards, but likely  not your AMD Radeon HD 5450; cross reference List of AMD graphics processing units with graphics/drm-510-kmod that states:

```
pkg-message:
    For install:
        The drm-510-kmod port can be enabled for amdgpu (for AMD
        GPUs starting with the HD7000 series / Tahiti) [...]
        radeonkms for older AMD GPUs can be loaded and there are
        some positive reports if EFI boot is NOT enabled (similar to amdgpu).
```

If you don't have a CPU with GPU, you'll have get a graphics card that is supported on 13.1 to get accelerated graphics performance; have a look at this thread


----------



## bsosenba (Dec 22, 2022)

Okay, but since there are still users on HD 5450 and since the current version of Linux still supports my workstation, it should be possible to create a legacy drm package, right? Where should I go to request that?


----------



## Erichans (Dec 22, 2022)

As mentioned, GraphicsAMD-GPU-Matrix at the HD 5450 states: "Works", though no explicit reference to 12.x or 13.x. Answers to Do Radeon HD 5450 graphics work under FreeBSD ? from 2018 state it works. More info after X startup from /var/log/Xorg.0.log could be helpfull but that would probably for others to pick up. If not answered here then perhaps the mailing list _freebsd-questions - User questions and technical support_ (as mentioned in C.2. Mailing Lists) can provide further help.


bsosenba said:


> Okay, but since there are still users on HD 5450 and since the current version of Linux still supports my workstation, it should be possible to create a legacy drm package, right? Where should I go to request that?


Unfortunately I don't have more knowledge about such a creation.


----------



## bsosenba (Dec 23, 2022)

Okay, thank you for your help!


----------

