From owner-freebsd-current@freebsd.org Tue Aug 14 09:13:16 2018 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E7291072228 for ; Tue, 14 Aug 2018 09:13:16 +0000 (UTC) (envelope-from johalun0@gmail.com) Received: from mail-wm0-x233.google.com (mail-wm0-x233.google.com [IPv6:2a00:1450:400c:c09::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DD9A386430 for ; Tue, 14 Aug 2018 09:13:15 +0000 (UTC) (envelope-from johalun0@gmail.com) Received: by mail-wm0-x233.google.com with SMTP id c14-v6so11513977wmb.4 for ; Tue, 14 Aug 2018 02:13:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=FCOEQoZ3MoVXlDoqF7wm+a/0XzIaolMztkomDs6cV84=; b=VbNGRk8EwJd/cDJTl1LZh4VDAZbA9n0EybBW3IAjb1lI9r2xjWWE/D4FyPH8LQqigi SeA64XVcohpIh67LaXAAnJKOYR9p6iaOZKfYKvEMWRlBek0Mwb3GLwMKMU71TiF0nvL8 J6VnnL+Ij2Bq7MFtgKwPTP6yJMoIkxjXho8KFMO4WDO22nDiJmVN3rDwWw0ejlegC2I4 ySPbmiRFNDzZtmeGaVdK8mTqOIBJcx4kfr6K6DQLXnXHV8rA0J7CQiydbEiCgu7K3CCy Y5HJ4dGWBd+9BM2S3y6b7qvzPsbb09uMRS5VT3PDtSbFSaZ3P1SsBxt/wkNfFNkimCQG BzRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=FCOEQoZ3MoVXlDoqF7wm+a/0XzIaolMztkomDs6cV84=; b=DrxcHjruddvO3N4Vr4ozCktnotIipA38O3EVP0LpWAnzY2G4BlVbDwu3EbULSr732x UDxb/JZRGJ0cKWfMfyvrKhSQM3nKbT+d8NEziQbe0I9Bf7J6LwhueMm0PmXR8O82r26o vOPF2FvqWvTcJSg0xq6llPfwZ9c2fR0BHXQ4ky0XhqVDzvJ4C1gvZiKmBdkSHoNHr+2N /rk2JCtqP72eVSGuOj5d87T6Hx5sH3/r+99CVyLlSyYIImtAn7Hp7qOdEte1Q3love3c yBZsrU3Sf08MYqnqh58lU60O0TV+cKlT3bRQ0I0ebysnod6PTBVLMilGrfbCntOszNY3 0oCQ== X-Gm-Message-State: AOUpUlGoAM1Zn/+j0FFKeWbDeCvImgeFrhU+cnquLxaZoVi3l74C2Cq+ 6d7jhEkdODCPFrrO+lQSjPmeB0lykEqYKSwl9rSDIiK2 X-Google-Smtp-Source: AA+uWPytWgzRViDr9yuDMUH2t3gFQHLoE/hsOxofqQf7gkZJ1aVLCr1cvd+WgJ6gfkT7A1XytBNvlxssnZkqpIae9Hw= X-Received: by 2002:a1c:f03:: with SMTP id 3-v6mr10291851wmp.129.1534237994659; Tue, 14 Aug 2018 02:13:14 -0700 (PDT) MIME-Version: 1.0 From: Johannes Lundberg Date: Tue, 14 Aug 2018 10:12:37 +0100 Message-ID: Subject: Make drm drivers use MTRR write-combine To: freebsd-current Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.27 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Aug 2018 09:13:16 -0000 Hi Something that we have seen for a long time on FreeBSD is the boot message Failed to add WC MTRR for [0xd0000000-0xdfffffff]: -22; performance may suffer Taking a closer look at this with memcontrol I can see that the 256 MB region that DRM wants to set as WC is already covered by this entry 0xc0000000/0x40000000 BIOS uncacheable set-by-firmware active Similar on both my Skylake and Broadwell systems. The linuxkpi wrapper can be found here: https://github.com/FreeBSDDesktop/kms-drm/blob/drm-v4.15/linuxkpi/gplv2/src/linux_mtrr.c There doesn't seem to exist a function for changing the properties of a sub region: https://github.com/FreeBSDDesktop/freebsd-base/blob/master/sys/dev/mem/memutil.c Any ideas of a good solution to this? Can this region be blacklisted or is there a safe way to split the big region into several regions with different flags when the drm driver loads? For reference, my AMD machine logs this # dmesg | grep MTRR Successfully added WC MTRR for [0xe0000000-0xefffffff]: 0; # memcontrol list --SNIP-- 0xff000/0x1000 BIOS write-protect fixed-base fixed-length set-by-firmware active 0x0/0x80000000 BIOS write-back set-by-firmware active 0x80000000/0x40000000 BIOS write-back set-by-firmware active 0xc0000000/0x20000000 BIOS write-back set-by-firmware active 0xe0000000/0x10000000 drm write-combine active Not sure if it's a BIOS or CPU vendor issue.