[#] он сказал openxcom!! :)
51t(lenina,1) — All
2014-07-21 15:49:40


g2k14: Jonathan Gray on driver improvements for X
Contributed by tbert on Sat Jul 19 08:24:01 2014 (GMT)
from the closing-holes-by-closing-apertures dept.

Jonathan Gray (jsg@) writes in to let us know why he spent 30 hours in coach to be with us:

One of the first things I did at g2k14 was import the Mesa update I've been working on for some time now. I've been tracking the Mesa git for a few months and submitting patches to reduce the amount of pain involved and given the local diff isn't too large anymore it seemed like a decent time to update. Shortly before the hackathon I ran into a problem getting Mesa to build on i386 however. It turns out there is an i386 only codepath that does a sysctl to check if SSE is enabled. This turned out to be a problem because sysctl.h pulls in uvm_extern.h which then pulls in a bunch of kernel headers including mutex.h which meant that Mesa's mtx_init() collided with the kernel's mtx_init(). Theo spent some time cleaning up the sysctl and uvm headers so they wouldn't include anywhere near as many definitions, and that work had already been committed when I arrived at the hackathon.

The following day I did some xenocara builds to try and catch any additional problems. The problem I found was due to a symlink in the Mesa dist file that cvs import ignores, which was fixed by pointing the Makefiles to a different directory. I also double checked that LLVM enabled Mesa builds worked still worked via the LLVMpipe software renderer. Another problem the Mesa builds showed is that sys.mk the Makefile that gets automatically included by make adds CFLAGS to CXXFLAGS. As Mesa is a mixture of C that assumes C99 and C++ code, g++ ends up complaining that it gets the C specific -std=c99 flag passed to it. A diff to correct this in the system Makefiles and a few other places will be mailed out in future.

I also looked into getting the src tree to build with OPENSSL_NO_DEPRECATED defined which in most cases involved adding includes that are not automatically pulled in by other includes anymore. For some things like nginx that are externally maintained there are patches already available in future versions that we'll eventually pick up so it doesn't seem worthwhile patching our version just yet when there are still other places in the tree (libkeynote/bind/sendmail etc) that need changes made. I also had a quick look at compiling with OPENSSL_NO_SSL_INTERN but after seeing how dc and gzsig broke when building I decided to look elsewhere.

I looked into updating some clang patches I've had lurking around for a few years and committed some things relating to that.

Xorg can now run without having to grant userland direct access to a window of kernel/device memory if kernel modesetting (KMS) is supported. The problem being other devices still need access to this window to run Xorg. The installer asks a question if it finds a vga device that enables the window via the machdep.allowaperture sysctl. After a discussion with a few people at g2k14 I created some small scripts to extract PCI vendor/product numbers from the radeondrm and inteldrm drivers which are used by the pci attachment of the vga driver to print a line to dmesg if the window will be needed to run Xorg. The installer has been modified by halex@ and rpe@ to check for this line and will only ask if the person installing intends to run X11 (which enables the window) if it is found. The X11 question will not be asked on many servers now as there is a blacklist of graphics devices commonly found in servers in the code that decides whether the aperture is needed.

A problem I've run into a few times now is the lack of a cpuid.h header which is provided by gcc >= 4.3 and clang to provide an interface to calling cpuid on i386 and amd64. Mesa git now requires cpuid.h to build. The Intel Xorg driver disables codepaths involved in deciding if SSE is present and making decisions based on cache sizes if it missing. And at least some ports (ie OpenXCOM) seem to expect it now. So I've taken the cpuid.h from clang to include in our version of GCC 4.2.1. Initially I changed the SSE_4_1 and SSE_4_2 definitions to SSE_41 and SSE42 to match the names used by GCC but likely both definitions will be included when this gets committed.

Many thanks to the OpenBSD Foundation and Mitja for making g2k14 possible.

[#] Re: он сказал openxcom!! :)
vit01(lenina,50) — 51t
2014-07-28 09:36:16


g2k14: Jonathan Gray on driver improvements for X

Джонатан Грэй (jsg@) сообщил нам, почему он провёл 30 часов в автобусе, чтобы быть с нами:

Одной из первых вещей, которые я сделал в g2k14, был импорт обновления Mesa, над которым я теперь работал в течении некоторого времени. Я следил за git репозиторием Mesa несколько месяцев и отправлял патчи, чтобы уменьшить всю ту боль, причинённую локальным diffом, который не был таким большим, но приходилось тратить много времени на обновления.

Незадолго до хакатона я столкнулся с проблемой, заставляя Mesa собираться на i386, как бы то ни было. Это происходит только в том куске кода, который с помощью sysctl проверяет, включен ли SSE. Это, как оказалось, было проблемой, потому что sysctl.h включает в себя utm_extern.h, который, в свою очередь, берёт заголовочные файлы ядра, включая mutex.h, это означает, что mtx_init() из Mesa конфликтует с mtx_init() ядра. Тео потратил немного времени, вычищая sysctl и заголовки utm, таким образом, они не будут включать где-либо много определений. Эту работу уже закоммитили, когда я пришёл на хакатон.

На следующий день я сделал немного сборок xenocara, чтобы найти любые дополнительные проблемы. Проблема, которую я нашёл, происходила из-за симлинка в файл дистрибутива Mesa, который игнорировался cvs import, что починили ссылками из Make-файлов в другую директорию. Я также проверил дважды работоспособность сборок Mesa со включенным LLVM, который всё ещё работал через программный рендеринг LLVMpipe.

Другая проблема со сборками Mesa заключалась в том, что sys.mk, автоматически включаемый через make в Makefile, добавляет CFLAGS к CXXFLAGS. Поскольку Mesa является смесью C, которая включает и код C99, с C++, g++ ругался на то, что к нему попадал C-специфичный флаг -std=c99. diff, который исправляет это в системных Make-файлах и некоторых других местах, будет потом отправлен по почте.

Я также проконтролировал, чтобы дерево исходников собиралось с OPENSSL_NO_DEPRECATED, который в большинстве случаев добавлял инклюды, которые больше автоматически не брались из других инклюдов. Для некоторых вещей, таких как nginx, которые поддерживаются извне, есть патчи, которые уже доступны в следующих версиях. Мы их потом возьмём, но пока что ещё не так уж и стоит патчить нашу версию, когда есть другие места в дереве (libkeynote/bind/sendmail и.т.д.), где требуется сделать изменения. Я также вскользь посмотрел на компиляцию с OPENSSL_NO_SSL_INTERN, но после того, как увидел, что dc и gzsig поломались во время сборки, я решил посмотреть в другие места.

Я посмотрел на обновление некоторых патчей clang, которые искал пару лет, и коммитил некоторые вещи, касающиеся этого.

Xorg теперь может работать без необходимости предоставлять прямой доступ из пространства пользователя к памяти ядра/устройства, если режим modesetting (KMS) ядра поддерживается. Проблема ещё заставляет некоторые устройства требовать доступ к этому окну памяти, чтобы запустился Xorg. Установщик задаёт вопрос, если находит vga устройство, которое включает окно через machdep.allowaperture sysctl. После обсуждения с парой людей на g2k14 я написал небольшие скрипты, чтобы забирать номера поставщика/продукта PCI из драйверов radeondrm и inteldrm, которые используются pci вложением в vga драйвер, чтобы написать строчку в dmesg, если это окно памяти требуется для запуска Xorg. Установщик был изменён halex@ и rpe@, чтобы проверить эту строку и теперь будет только спрашивать, нужно ли человеку запускать X11 (который включает окно), если оно найдено. Вопрос X11 не будет задан теперь на многих серверах, так как есть чёрный список серверных графических устройств в коде, решающем, нужен ли aperture.

Проблема, с которой я столкнулся теперь несколько раз, - это недостаток заголовка cpuid.h, который идёт из gcc >= 4.3 и clang, чтобы обеспечить интерфейс, запрашивающий cpuid на i386 и amd64. Mesa из git теперь требует cpuid.h для сборки. Intel-овский драйвер Xorg отключает код, включённый в решение, если SSE присутствует, и делает решения, основанные на размерах кэша, если его нет. И, по крайней мере, некоторые порты (т.е. OpenXCOM), кажется, теперь его ждут. Таким образом, я взял cpuid.h из clang, чтобы включить его в нашу версию GCC 4.2.1. Сначала я изменил определения SSE_4_1 и SSE_4_2 на SSE_41 и SSE42, чтобы соответствовать именам, используемым в GCC, но, вероятно, они оба будут включены, когда это закоммитят.

Большое спасибо OpenBSD Foundation и Мите за g2k14!