|
|
Subscribe / Log in / New account

Linux on the Mac — state of the union

Benefits for LWN subscribers

The primary benefit from subscribing to LWN is helping to keep us publishing, but, beyond that, subscribers get immediate access to all site content and access to a number of extra site features. Please sign up today!

November 30, 2016

This article was contributed by Lukas Wunner

The MacBook Pro introduction in October caused unusually negative reactions among professional users due to the realization that Apple no longer caters equally to casual and professional customers as it had in the past [YouTube video]. Instead, the company appears to be following an iOS-focused, margin-driven strategy that essentially relegates professionals to a fringe group. This has well-known developers such as Salvatore Sanfilippo (of the Redis project) consider a move back to Linux. Perhaps that's a good moment to look at the current state of Mac hardware support in the kernel. While Macs are x86 systems, they possess various custom chips and undocumented quirks that the community needs to painstakingly reverse-engineer.

GPU switching

Apple is the only remaining vendor to build a multiplexer into hybrid graphics laptops, which have both high-end and low-power GPUs. The multiplexer allows the panel to be switched between the GPUs and the unused GPU to be powered off. All other manufacturers use a "muxless" solution, whereby the discrete GPU is headless and copies rendered data over PCIe into the integrated GPU's framebuffer. "Muxed" solutions, such as the one used by Apple, offer superior power saving and latency, but are more difficult to implement.

The multiplexer built into pre-Retina MacBook Pros is a custom Lattice XP2 FPGA, which is documented to some extent in patent US 8,687,007 B2 [PDF]. Retinas moved to a different display connector (eDP instead of LVDS) to accommodate the higher pixel clock and this forced Apple to come up with a redesign which consists of two chips, a Renesas H8S/2113 controller and a separate off-the-shelf eDP multiplexer from NXP [PDF], TI [PDF], or Pericom [PDF].

Pre-Retina MacBook Pros use a Lattice XP2 (blue) to combine the controller and multiplexer in a single custom chip. Image courtesy of iFixit.

A driver for the controller was written by Seth Forshee in 2012, initially only to control backlight brightness. Andreas Heider subsequently added switching control. Matthew Garrett and Bernhard Frömel contributed code to handle register access on the H8S/2113. (It has the same register layout as its predecessor Lattice XP2, but the registers are accessed via a mailbox rather than directly.)

The panel resolution stored in the video BIOS is notoriously bogus on Macs, so it needs to be probed instead by temporarily switching the DDC lines between GPUs. Attempts to implement this were made by Forshee, Garrett, and Dave Airlie but not pursued into mainline. Development therefore stagnated for about three years. I started another effort in 2015 and the resulting patches that finally enable GPU switching on pre-Retinas were merged into 4.6. A byproduct was documentation on vga_switcheroo and Apple's multiplexer.

The original "unibody" MacBook Pro introduced 2008-2009 with dual NVIDIA GPUs required several extra changes that were figured out by Pierre Moreau. There is one remaining glitch related to hardware acceleration of the console framebuffer that can be worked around by loading nouveau with the nofbaccel option. This machine is no longer supported by Apple since macOS Sierra. Notably, macOS was never capable of switching at runtime on this model or using both GPUs simultaneously, so Linux is squeezing more out of the hardware than Apple ever did.

However a lot still remains to be done: so far, the discrete GPU has to be turned on and off manually by the user. I have begun a set of patches to add runtime power management support which will handle this automatically, however it turned out that a rework of vga_switcheroo audio handling is necessary first, based on Rafael Wysocki's functional dependencies series, which is queued for 4.10. Another unresolved issue is a short flicker during switching if the vertical blanking intervals (VBLANK) of the GPUs happen not to be in sync. Apple's patent talks about the gmux controller lengthening or shortening VBLANK intervals to achieve a seamless switch, but in reality this is not performed by the chip and needs to be done in software instead. Further down on the to-do list is switching while X11 (or Wayland) is running. Currently, switching is only possible on the framebuffer console with no clients connected to the DRM drivers. Airlie has stated that improving this situation is a low priority for him.

Retina MacBook Pros such as this one introduced in October use an H8S/2113 controller (yellow) and accompanying NXP CBTL06142 multiplexer (in-between the GPU and CPU). Image courtesy of iFixit.

While GPU switching on pre-Retinas works, it doesn't yet on Retinas. Once again there is no valid panel resolution stored in the video BIOS, so both GPUs need to probe it. However unlike on pre-Retinas, the AUX channel (which is the DDC equivalent for DisplayPort) is not switchable between GPUs without also switching over the main link. The active GPU therefore has to either cache the panel data or proxy the inactive GPU's access to the panel. Additionally, both GPUs need to link-train their eDP outputs: the DisplayPort specification has a special provision for closed, embedded connections which allows outputs to be set up with a pre-calibrated, known-good drive current and pre-emphasis level. A solution would thus be to have the inactive GPU set up its output with pre-calibrated values determined by the active GPU.

I implemented a few prototypes of this in 2015, which were tested with partial success by Bruno Bierbaumer. Unfortunately Bierbaumer's MacBook Pro suffered an accident (unrelated to the patches) and development has since stagnated. Generally, it is hard to bring up features like this without having the hardware in front of you. Sending patches and dmesg output back and forth only gets one so far. (My own machine is a pre-Retina.) For the time being, Retina users should consider using Bierbaumer's gpu-switch application, which allows selecting the active GPU for the next reboot. The inactive GPU may then be powered down via vga_switcheroo to conserve energy.

Retinas introduced 2013 and onward have an additional requirement for GPU switching: Either the bootloader or the EFI stub in the kernel need to identify as macOS to the firmware, otherwise the integrated GPU is powered down and thus hidden from the operating system. The rationale is that Apple only supports macOS and Windows on its hardware, but never bothered to enable GPU switching on Windows. If the operating system does not identify as macOS, the EFI firmware assumes that it is dealing with Windows and disables various features of the hardware.

This identification scheme is similar in spirit to the ACPI _OSI method but happens before the EFI ExitBootServices() call (i.e. much earlier than the kernel's ACPI subsystem is initialized). It is not necessary on pre-2013 models, which assume Windows when booting in the legacy BIOS mode and macOS otherwise. Users need to be aware that if they expose the integrated GPU on 2013+ models, loading the i915 driver results in an interrupt storm that can be avoided by disabling an ACPI general-purpose event (GPE) via sysfs.

Thunderbolt

Thunderbolt controllers comprise a PCIe switch whose fabric is managed in either of two ways: by a firmware component called Intel Connection Manager (ICM) or natively by the operating system. In the former case, PCI tunnels to newly attached devices are configured in System Management Mode (SMM) behind the operating system's back and the devices appear below ACPI PCI hotplug slots. This is what most vendors do. Apple took the other approach and ships two drivers: an EFI driver that configures devices already attached on boot, and a macOS driver that assumes control after the ExitBootServices() call. When booting Windows, Apple powers the controller off on older machines or reconfigures it at runtime to be controlled by ICM on 2015+ models.

In principle, Apple's approach of foregoing a firmware blob is desirable from a free-software perspective. However Apple's drivers are closed source and Intel hasn't made the Thunderbolt specification public. Andreas Noever took on the Herculean task of reverse-engineering the macOS driver and writing a basic Linux driver. The resulting patches went into 3.17 and initially supported two chips: Cactus Ridge 4C and Falcon Ridge 4C. This year, we have been able to broaden support to further chips:

Light Ridge 4C (Macs introduced 2011-2012) supported since 4.7
Eagle Ridge 2C (MacBook Air introduced 2011) unsupported, try this patch and report back
Cactus Ridge 4C (Macs introduced 2012-2013) supported since 3.17
Falcon Ridge 4C (Macs introduced 2013-2015) supported since 3.17
Falcon Ridge 2C (MacBook Air introduced 2015) supported since 4.8
Alpine Ridge 4C (MacBook Pro introduced 2016) unsupported, try this patch and report back

Thunderbolt controllers consume about 2W even when idle. Apple provides a nonstandard ACPI-based mechanism to power the controller down when nothing is plugged in and I have implemented patches this year to make use of it on Linux. A first preparatory series is in 4.9 to avoid gratuitously waking the controller before and after system sleep. A second preparatory series is queued up for 4.10 to add runtime power management for PCIe Hotplug ports. A third series containing the actual runtime power management for the Thunderbolt controller is slated for 4.11. The patches improve battery life noticeably: idle power consumption on my MacBook Pro drops from 12.2W to 10.5W when powering down Thunderbolt (with the discrete GPU, and AirPort already disabled). macOS achieves 7W as it supports power management on more devices, such as Firewire.

Another upcoming feature is EFI device properties: Thunderbolt controllers possess a 64-bit unique ID, which allows telling them apart when connected together. The ID is stored in a device ROM that the vendor is supposed to burn at the factory. Curiously, Apple skipped that step on Thunderbolt 1 chips and left the device ROM blank with an ID of 0x1000000000000. So how does the controller get a unique ID? It turns out that the EFI driver generates a device ROM with an ID based on the Mac's serial number and communicates it to the macOS driver as a device property.

For Linux 4.10 I submitted patches to retrieve these properties and use the device ROM supplied by EFI in the Thunderbolt driver. The kernel needs to be booted by the EFI stub for this to work. The properties contain a lot more than just the device ROM (e.g. they convey which PCI tunnels were established by the Thunderbolt EFI driver and how the graphics EFI drivers configured the GPUs). See this sample that was generated with the kernel command line option dump_apple_properties. Apple seems to have been using this proprietary protocol for EFI device properties ever since they moved to x86 in 2006, so it took ten years for Linux to catch up. Nevertheless, having that data available now puts us in a much better position to support Macs optimally.

Current work focuses on coping with surprise removal and fixing system sleep-related bugs in the PCIe hotplug driver. Many Thunderbolt features are still needed, such as support for daisy-chaining and establishing DisplayPort-over-Thunderbolt tunnels.

Networking is another area that needs work, specifically it needs a driver for Mac hardware. Thunderbolt 3 is marketed as having a total bandwidth of 40 Gbit/s, which in reality is capped at 32 Gbit/s by the 4x PCIe 3.0 interface of currently available controllers. Still, this promises to rival 25G Ethernet and InfiniBand at a lower price point. The MacBook Pro introduced in October has four Thunderbolt 3 ports which would enable interesting applications like a portable compute cluster with up to five fully-meshed nodes. macOS introduced Ethernet-over-Thunderbolt tunneling in 2013 and Intel ported it to its closed-source Windows driver a year later.

Apparently due to demand from vendors such as Dell, Intel also developed a Linux driver whose source code was surprisingly made public this year and is now at its ninth iteration. However the released code mostly just contains the plumbing between the kernel's networking subsystem and the firmware-based ICM. The real action happens in firmware, which remains closed source. And the dependency on ICM means that the patches only work on non-Macs.

Even so, Intel's driver duplicates a portion of Noever's driver. When asked to eliminate duplicate code and move the remainder into the existing Thunderbolt driver, Intel responded in a somewhat tight-lipped manner that it "does not maintain, develop, and publish Thunderbolt software code running on Apple hardware", which sounds like it came straight out of the legal department to avoid stepping on the toes of their key account in Cupertino. Obviously, having some source code is better than no source code, but Greg Kroah-Hartman has been reluctant to merge the additional driver and has pushed for more review.

Firmware quirks

The EFI firmware on Macs contains a network stack to facilitate downloading macOS recovery images from Apple. A particularly egregious bug is present in the EFI driver for Broadcom 4331 wireless chips built into various 2011 and 2012 Macs as it fails to disable the card upon the ExitBootServices() call. As a result, the card causes an interrupt storm and corrupts memory with DMA transfers of received packets. In principle, this can be used for remote code execution over the air. Garrett discovered the issue in 2012 and sought to fix it with a GRUB quirk, but this only addressed memory corruption and not the interrupt storm, so users continued to see messages such as "irq 17: nobody cared". For Linux 4.7, I submitted an early quirk to reset the wireless card that finally fixes the issue for good. It has also been picked up by all supported stable kernels.

MacBook Pros introduced in 2015 suffer from a similarly annoying issue caused by an unused PCIe root port that Apple forgot to disable in the firmware. The root port is invisible to macOS because it is not enumerated in the ACPI tables, but Linux discovers and initializes it, thereby breaking suspend and power off on these machines. Chen Yu has posted a workaround patch which is not yet in mainline but already included in distributions such as Ubuntu.

SPI input devices and NVMe

Before 2015, mobile Macs used USB to connect the keyboard and trackpad. Newer models equipped with a Force Touch trackpad moved to a custom controller that connects to the southbridge with SPI. On the first model to do so, the MacBook Pro 13" (Early 2015), the controller alternatively supports USB and is switchable between the two interfaces by way of ACPI methods. In USB mode, this model is supported by mainline kernels. All following machines, notably the MacBook 12", leave the USB pins unconnected and are SPI only. Federico Lorenzi has begun reverse-engineering the controller's protocol and developing an experimental out-of-tree driver.

The MacBook 12" also has a custom NVMe controller, which is known to not come out of system sleep, apparently due to missing vendor-specific commands.

In conclusion

Users wishing to try Linux as a dual boot option alongside macOS may want to consider ZFS as it allows cross-mounting between the two operating systems in a stable manner. Other Linux filesystems such as ext4 or Btrfs are unfortunately not well supported on macOS. Vice-versa, HFS Plus on Linux does not support journaling and FileVault2 support is experimental. Kernel developers need however be aware that loading the ZFS modules disables lockdep due to the CDDL taint.

Bringup on Macs is a challenge, but on the bright side we are making huge leaps with every new release. Supporting new hardware generally takes about two years, anything older can be expected to work decently. Battery life is not yet on par with macOS, Thunderbolt lacks many features, and GPU switching only works on pre-Retinas. Despite these limitations, Mac hardware support is significantly ahead on Linux compared to other free operating systems. To quote Apple's classic commercial [YouTube video]: "here's to the crazy ones" who are bringing up Linux on the Mac.

Index entries for this article
GuestArticlesWunner, Lukas


(Log in to post comments)

Linux on the Mac — state of the union

Posted Dec 1, 2016 2:01 UTC (Thu) by mmeehan (subscriber, #72524) [Link]

On the other hand, Dell's XPS 13 ships with Ubuntu 16.04 and newer hardware for the same price. I wish more developers would vote with their dollar.

Then again, folks get religious about brand identity.

Linux on the Mac — state of the union

Posted Dec 1, 2016 2:45 UTC (Thu) by montj2 (guest, #111739) [Link]

What about the custom touchbar support? Do you think that will *ever* be possible? I mean, we're talking about several generations of Apple products that will fail to even support function keys.

Linux on the Mac — state of the union

Posted Dec 1, 2016 14:49 UTC (Thu) by Cyberax (✭ supporter ✭, #52523) [Link]

Touchbar falls back to F-keys by default if no special configuration is applied.

Linux on the Mac — state of the union

Posted Dec 1, 2016 15:26 UTC (Thu) by zdzichu (subscriber, #17118) [Link]

You have to load operating system into TouchBar during boot – https://onemoreadmin.wordpress.com/2016/11/27/the-untouch...
So I doubt it "falls back to F-keys", by default it seem to be empty.

Linux on the Mac — state of the union

Posted Dec 1, 2016 15:39 UTC (Thu) by Cyberax (✭ supporter ✭, #52523) [Link]

Yes, but it's done through EFI. I don't think there's anything that needs to be done by the OS itself.

Linux on the Mac — state of the union

Posted Dec 1, 2016 9:49 UTC (Thu) by jond (subscriber, #37669) [Link]

> newer hardware for the same price

*Different* hardware. We can't compare Apples to Oranges.

Linux on the Mac — state of the union

Posted Dec 7, 2016 16:23 UTC (Wed) by drag (guest, #31333) [Link]

They are all manufactured by the same Chinese/Taiwanese manufacturers.

By and large the only thing special about Apple is their weirdness when it comes to things like described in the article. That is, besides, their cases and such.

Linux on the Mac — state of the union

Posted Dec 7, 2016 17:04 UTC (Wed) by clopez (guest, #66009) [Link]

Really? Whats different? Maybe the CPU architecture?

Linux on the Mac — state of the union

Posted Dec 1, 2016 11:49 UTC (Thu) by mips (guest, #105013) [Link]

I wonder whether there is a greater degree of continuity between MacBook Pros, meaning that development effort expended to get Linux working doesn't seem wasted?

A quick look at Wikipedia tells me the XPS 13 has been around since 2012, but I've no familiarity with them, and don't know whether the early XPS 13 was similar to today's.

Either way, design decisions like a non-user-replaceable battery and soldered RAM keep me away from either line.

Linux on the Mac — state of the union

Posted Dec 1, 2016 17:58 UTC (Thu) by excors (subscriber, #95769) [Link]

I think they've mostly just been incremental changes - newer CPU generations, different wifi cards, etc. And Dell puts effort into officially supporting Linux and upstreaming patches, and can select hardware that's going to work okay, and can fix BIOS bugs properly instead of hacking kernel workarounds for them, so there should be less need for volunteers to waste time on model-specific hardware support than for most other brands.

Also they seem to be using fairly standard components, so any effort spent supporting them is likely to help a lot of other devices that happen to use the same components, whereas it sounds like Apple innovates so much that a lot of the work needed is not just Apple-specific but is specific to a single Apple model.

(I got an XPS 13 recently, partly to support companies that support Linux, partly so I didn't have to worry about compatibility, and partly because it sounds like one of the best small laptops regardless of OS. There are still bugs on Linux (e.g. the official USB-C-to-HDMI adapter is apparently fine on Windows but only appears to work at sub-1080p resolutions on Linux) but generally it seems pretty nice.)

Linux on the Mac — state of the union

Posted Dec 2, 2016 22:56 UTC (Fri) by ibukanov (subscriber, #3942) [Link]

I use xps-13 with a generic usb-c - HDMI dongle (30usd before VAT in Norway). It works with a 4k monitor at 30fps. The only annoyance is that it takes like 6 seconds for the monitor to show a picture after connecting the cable or bringing back it from a sleep mode.

Linux on the Mac — state of the union

Posted Dec 2, 2016 13:59 UTC (Fri) by anton (subscriber, #25547) [Link]

c't has a review of the latest Dell XPS13 Developer edition (german, paywall) under Linux. They found a few warts, e.g., IIRC some clicking when dealing with sound, and less run-time than under Windows (IIRC 11h vs. 22h or so).

Lenovo sells some laptops without OS. I am pretty happy with my E130 (no longer on sale). I have also tested the E31-80 with Ubuntu 16.04, but found it lacking: only 4h battery running time when idle, WLAN needs reinitializing after suspension (possibly fixed with a newer driver; the device is a "Qualcomm Atheros Device 0042"); and for my taste it's simply too big.

Linux on the Mac — state of the union

Posted Dec 3, 2016 0:00 UTC (Sat) by anselm (subscriber, #2796) [Link]

I have a Lenovo X250 from work and it's a sweet machine. The only thing I don't really like is the small display. I just took delivery of a T460 for myself (mostly because it has a bigger screen but uses the same docking station as the X250, which is convenient for working from home) and that is shaping up very nicely, too.

Linux on the Mac — state of the union

Posted Dec 3, 2016 0:27 UTC (Sat) by karkhaz (subscriber, #99844) [Link]

In my experience Lenovo X2?? laptops have excellent Linux support, I'm very happy with my X230 (and yes, the docking station is lovely); and I know lots of folks with later models. I particularly like that the internal 3G modem works flawlessly, as these things often have terrible Free software support, but Sierra modems tend to play well with NetworkManager.

Linux on the Mac — state of the union

Posted Dec 7, 2016 21:29 UTC (Wed) by danjared (guest, #80166) [Link]

The battery on the XPS 13 is user-replaceable. Here's the service manual section for doing that on the current model: http://www.dell.com/support/manuals/us/en/19/xps-13-9360-...

(Necessary notice: I work on Linux at Dell.)

Linux on the Mac — state of the union

Posted Dec 7, 2016 21:45 UTC (Wed) by micka (subscriber, #38720) [Link]

I'm interested. Does this apply to the 9333 ?
Mine won't charge above 75% (well, provided plasma's charge indicator is correct).

Linux on the Mac — state of the union

Posted Dec 8, 2016 0:53 UTC (Thu) by ras (subscriber, #33059) [Link]

I have a new XPS-15. There are lots of places Dell marketing says various bits aren't "user replaceable", and that includes the battery.

The first thing I did after getting the thing was to remove the back. I've pulled apart every Dell laptop I've owned for various reasons. This was *by far* the easiest to disassemble. You only have to remove screws on the back that are easy to find.

Once you do remove the back you are confronted with a sticker on the non-user replaceable battery. It says quote: "Please Disconnect and Remove Battery before Accessing The Rest Parts and Devices".

Linux on the Mac — state of the union

Posted Dec 8, 2016 4:04 UTC (Thu) by mjg59 (subscriber, #23239) [Link]

The battery in the XPS 13 is apparently classified as user replaceable - they were happy to send me a replacement without sending a tech.

Linux on the Mac — state of the union

Posted Dec 12, 2016 8:42 UTC (Mon) by gravious (guest, #7662) [Link]

Good to know! Thanks!

Linux on the Mac — state of the union

Posted Dec 2, 2016 0:09 UTC (Fri) by JdGordy (subscriber, #70103) [Link]

Is that a US only thing? I just checked the .au dell site and the only OS options on the XPS13 is win10 :/

Linux on the Mac — state of the union

Posted Dec 2, 2016 0:37 UTC (Fri) by excors (subscriber, #95769) [Link]

https://bartongeorge.io/2016/10/04/the-new-xps-13-develop... says Europe, US, Canada.

https://bartongeorge.io/2015/02/05/update-dell-xps-13-lap... (about an earlier generation) has a comment saying "Unfortunately the XPS 13 developer wont be offered in Australia at this time" (that was nearly two years ago but it doesn't sound like the situation has changed yet).

Linux on the Mac — state of the union

Posted Dec 2, 2016 1:02 UTC (Fri) by JdGordy (subscriber, #70103) [Link]

groan :) thanks

Linux on the Mac — state of the union

Posted Dec 2, 2016 6:34 UTC (Fri) by gdt (subscriber, #6284) [Link]

On the plus side, the work Dell did to make Linux run on the XPS13 has mostly been upstreamed. So Linux installs on the XPS13 without many of the usual dramas.

The major problem I've had isn't with the XPS13 itself, but the spottiness of HiDPI support for multiple-resolution screens (eg, if you give lots of presentations then Linux HiDPI isn't yet for you; or to put it another way, you need Wayland if you are serious about HiDPI and Wayland still breaks some basic things, like running ~/.bash_profile).

Linux on the Mac — state of the union

Posted Dec 6, 2016 22:17 UTC (Tue) by voltagex (subscriber, #86296) [Link]

I've got an XPS 13 9350 - the patches to support NVMe aren't in yet, and it doesn't look like they will be any time soon [1]

1: http://marc.info/?l=linux-ide&m=147716441701110&w=2

Linux on the Mac — state of the union

Posted Dec 8, 2016 0:05 UTC (Thu) by Matt_G (subscriber, #112824) [Link]

I live in Australia and purchased an XPS 13 last week (Dell had a 15% off offer on their website). More specifically I have the 2016 - 9360 model. The laptop came with Windows 10 preinstalled. I installed Fedora 25 on it. I have hit a few issues so far.

The biggest issue was Fedora installer did not recognize the Laptop's built in SSD. I did some searching on the web Arch Linux wiki is very useful and was able to fix this by entering the BIOS and changing the SATA controller to AHCI mode and disabling Secure boot. After I did this Windows would no longer boot. Not an issue for me but it maybe a problem if you wish to dual boot.

I see a few error messages flash up early on in the boot ( 'Ath10k failed to load firmware') but everything seems to work once the system is booted (including stable wifi connection).

The first time I closed the lid it failed to wake from suspend and I had to power cycle it. However it has successfully woken each time I have closed the lid subsequently. I have updated all of the packages on system since then however so it may have been as issue with the initial Fedora 25 installation which has subsequently been fixed.

Trackpad is probably biggest issue it feels very poor to use and often does not register clicks.

I can't comment on battery life as I never ran Windows on it for comparison and I mostly operate it plugged in to a power outlet.

Overall I'm mostly satisfied - however given Dell's support for Linux I would have expected it to work better out of the box (especially the SATA controller) and I am disappointing with Trackpad.

Linux on the Mac — state of the union

Posted Dec 8, 2016 1:13 UTC (Thu) by ras (subscriber, #33059) [Link]

> Trackpad is probably biggest issue it feels very poor to use and often does not register clicks.

Make sure you are using libinput, as opposed to the Synaptics driver.

> The first time I closed the lid it failed to wake from suspend and I had to power cycle it.
> given Dell's support for Linux I would have expected it to work better out of the box (especially the SATA controller)
> The biggest issue was Fedora installer did not recognize the Laptop's built in SSD.

Intel, Intel, Intel. Intel hasn't published the specs for the "RAID" mode of their new chipsets. Their GPU drivers were abysmal, causing suspend / resume to fail (you probably could have ssh'ed in). I'm not sure "were" is the right word as they still are iffy in some corner cases - I'm hoping they will be solid in 4.9. Windows didn't have the "RAID" problem because Intel wrote a Windows driver, but if anything it has lagged behind the latest released Linux kernel when it comes to GPU support. (I have a theory the reason Apple didn't release a refresh for so long is Intel could not supply reliable GPU drivers / firemware.)

Be sure to keep your BIOS up to date - it helps with the GPU issues. Also, until this settles down ensure you poll Intel's site for GPU firmware: https://01.org/linuxgraphics/downloads

> I mostly operate it plugged in to a power outlet.

Then ensure you tell the BIOS to keep the battery at about 60%. This will do wonders for your battery longevity.

Linux on the Mac — state of the union

Posted Dec 8, 2016 2:29 UTC (Thu) by Matt_G (subscriber, #112824) [Link]

Thanks, I assumed something like that was the case. For hardware as new as this is it works remarkably well. Miles better then where things used to be.

Linux on the Mac — state of the union

Posted Dec 2, 2016 22:59 UTC (Fri) by giraffedata (guest, #1954) [Link]

Then again, folks get religious about brand identity.

But if you're not running MacOS, you've given up the Apple brand.

So I still wonder what, besides the challenge, people want out of Linux on Mac hardware.

Linux on the Mac — state of the union

Posted Dec 5, 2016 19:44 UTC (Mon) by rgmoore (✭ supporter ✭, #75) [Link]

Apple does put together some very nice hardware packages, not just in terms of raw specs but also in terms of design and quality of the components they use. They've cared about a lot of that stuff for longer than most of their competitors, so they have brand loyalty for their hardware even among some people who want to rip out their software and replace it with Linux.

Linux on the Mac — state of the union

Posted Dec 5, 2016 22:34 UTC (Mon) by mathstuf (subscriber, #69389) [Link]

In the office the latest round of hardware is getting sour reviews. No new Mini, a lackluster laptop, and a still overpriced and under powered cylinder. The only thing left is the one that lives in a monitor which can't be a machine that just lives under a desk all that easily.

Linux on the Mac — state of the union

Posted Dec 5, 2016 23:25 UTC (Mon) by bronson (subscriber, #4806) [Link]

Same here. Their entire laptop line is getting weak against the competitors (possible exception for the niche 12" MacBook), and the Mini and Pro are downright embarrassing. About the only thing that still shines is the retina iMac.

I'm hoping Dell and Asus smell blood and move in for the kill.

Linux on the Mac — state of the union

Posted Dec 6, 2016 20:38 UTC (Tue) by rgmoore (✭ supporter ✭, #75) [Link]

It's certainly possible for Apple to lose some of their brand loyalty by putting out lame products or failing to keep their good ones updated. I've never liked their design approach. They're always looking for the next big thing and throwing away the current useful thing to make space, so you wind up having to buy new accessories or new dongles (which undermine the alleged simplicity of the design) with every new generation. Their ridiculous decision to go with a single USB type-C port as their only external connection on the new non-pro MacBook seems like the ultimate expression of that thinking.

Why bother?

Posted Dec 7, 2016 11:22 UTC (Wed) by timrichardson (subscriber, #72836) [Link]

Three weeks with an 2011 Thinkpad w520 as an experiment to see what life is like after Macbook Pros has been a tremendous success. I have even Optimus working on three screens. This ancient machine can take 32 GB (since for $AUD 360 I got a quadcore). If I bought a 15" Macbook in 2017, it would max out at 16GB, the same as an old Macbook pro my son has ended up with. It still has a DVD drive, that's how long the macs have been stuck at 16GB. I don't think the 15" Macs have a compelling hardware argument any longer that would encourage me to deal with the problems of running Linux. What's the pay back? The pursuit of thinness has meant inferior keyboards, 2010-era RAM capacity, a terrible port selection and no expandability to go with a sealed battery and glossy screens. As for battery life, this ancient W520 on its original battery still gets me five to six hours. That's a 2nd gen i7. Skylake should knock the socks of it.

A good thing about Macs is they have high resale value. I'll sell mine, and it will pay for my experimental W520 and the P50 on the way. Apple doesn't help Linux, and there doesn't seem to be much reason any longer to even try.

Ubuntu by the way has been amazing. While I use linux a lot on servers, and increasingly in desktop VMs, I did not expect it to be such a capable replacement as a daily driver. I am completely convinced now.

Linux on the Mac — state of the union

Posted Dec 12, 2016 21:14 UTC (Mon) by hobarrera (guest, #101888) [Link]

Did you even read the article? It talks in great details about unique hardware features that no other vendor offers (which are really useful for battery-saving).

Linux on the Mac — state of the union

Posted Dec 13, 2016 1:09 UTC (Tue) by anselm (subscriber, #2796) [Link]

My Lenovo T460 seems to get at least 10–12 hours of use out of a single charge using stock Debian pre-Stretch, probably more with tweaking. I don't really see why I should pay extra for some “unique hardware features” and apparently a lot of drama just getting Linux installed. Given that the T460 has two batteries, one of which can easily be swapped out while the computer is running, it's probably simpler and cheaper (both in terms of real money and time saved) to buy another battery.

Linux on the Mac — state of the union

Posted Dec 1, 2016 8:04 UTC (Thu) by shalem (subscriber, #4062) [Link]

"Apple is the only remaining vendor to build a multiplexer into hybrid graphics laptops" oh, how I wish that were true. Unfortunately that statement is false, e.g. the Lenovo P50 and P70 (both current gen laptops) still contain a mux between the igpu/dgpu and the panel.

Linux on the Mac — state of the union

Posted Dec 1, 2016 23:59 UTC (Thu) by ncm (guest, #165) [Link]

But randr knows how to operate it. Mostly.

At one point I had 1920x1080 on the built-in panel and on an HDMI monitor, and 2560x? on a DP monitor. For a long moment.

But I read about people using a VM directly operating the NV chip and external monitor, while the Intel thing is used natively on the built-in panel. I have not tried it yet.

Linux on the Mac — state of the union

Posted Dec 2, 2016 1:36 UTC (Fri) by Lekensteyn (subscriber, #99903) [Link]

I think that Lukas referred to hardware muxes which you can switch at runtime. The class of laptops you mention ("gaming" laptops, often i7-6700HQ + Nvidia GTX 9xxM/10xx) have a mux that can only be switched in the firmware setup ("BIOS"). If that option exists at all... (It does exist for the Clevo P6xxRx family.)

Perhaps you can actually control the hardware from software, but since the ACPI tables have no MXDS/MXMX methods to do this, it will be very hardware-specific. (Microsoft has forbidden this mux switching in their Win8 (10?) hardware certification requirements, probably due to bad UX from flickering during the switch.)

Thanks Lukas for writing this, very informative!

Linux on the Mac — state of the union

Posted Dec 1, 2016 12:06 UTC (Thu) by hadess (subscriber, #24252) [Link]

Thanks Lukas, and thanks for all the work!

/me goes to file bugs :/

Linux on the Mac — state of the union

Posted Dec 2, 2016 9:23 UTC (Fri) by l1k (subscriber, #112260) [Link]

Thank you too Bastien for working on user space integration of hybrid graphics! :-)
(Unfortunately this isn't mentioned in the article because it is confined to the kernel side of things.)

HP Spectre x360

Posted Dec 1, 2016 19:28 UTC (Thu) by Per_Bothner (subscriber, #7375) [Link]

If you want a reasonably high-powered portable/convertible with Thunderbolt 3, I'm pretty happy so far with my new Kaby Lake-based HP Spectre 360. Fedora 25 handles everything so far, including touchscreen, wifi, sound. Using an inexpensive ($70) USB-C docking station I can connect a 4k monitor, Ethernet, and other devices - on Fedora! (There are some occasional glitches with the monitor which I haven't figured out. I don't know if it's the hardware, Fedora, the docking station, or the monitor. Probably the docking station, since I don't seem to have problems when using a plain USBC-to-HDMI converter.)

It's not the fastest machine you can get, but Kaby Lake / 16G / 512G PCIe SSD is pretty decent; the price is fair (I found a $195-off coupon, but it's not bad even at list); and I like having a very lightweight 13" convertible I can carry everywhere, and hold in my hands for more than 30 seconds.

(Be careful you don't unintentionally buy last year's model. Those might be worth considering if you get one on sale: It does have extra connectors compared to this year's model, including HDMI, but it doesn't have Thunderbolt 3 or Kaby Lake.)

HP Spectre x360

Posted Dec 2, 2016 2:05 UTC (Fri) by tao (subscriber, #17563) [Link]

My guess? The USB Type-C docking station uses MST for the display connector(s), while the USB-C to HDMI converter just adds a regular HDMI port. So most probably it's a driver, not a hardware, issue.

HP Spectre x360

Posted Dec 2, 2016 2:20 UTC (Fri) by Per_Bothner (subscriber, #7375) [Link]

Quite possible. The flakiness seems to happen after sleeping or display blanking timeout, IIRC. After which the Display setting window thinks the external monitor is enabled - but it isn't. At which point the only thing I can so is unplug the monitor and plug it into the USB-C to HDMI converter, and then it's usable.

I can try to observe more carefully if someone tells me what information they want me to gather.

HP Spectre x360

Posted Dec 6, 2016 18:39 UTC (Tue) by jani (subscriber, #74547) [Link]

The HDMI Alt Mode for USB Type C spec is brand new. I suspect it's DP Alt Mode with a DP-HDMI converter.

Linux on the Mac — state of the union

Posted Dec 2, 2016 5:53 UTC (Fri) by imgx64 (guest, #78590) [Link]

Instead of ZFS, how about UDF? I format my flash disks and external HDDs with UDF so I can use them on Linux, Windows, and macOS. It's the only filesystem I found to work (read AND write) out of the box on all three OSs.

I don't know how well it would work for /home/, but you could create a UDF partition and use it to move files between Linux and macOS.

Linux on the Mac — state of the union

Posted Dec 10, 2016 9:14 UTC (Sat) by aorth (subscriber, #55260) [Link]

In the last few years exFAT has been a good choice too.

Linux on the Mac — state of the union

Posted Dec 10, 2016 10:22 UTC (Sat) by jem (subscriber, #24231) [Link]

> In the last few years exFAT has been a good choice too.

Choice, yes. Good? No. There is no mainline kernel implementation of exFAT. There is a FUSE implementation, and maybe some non-mainline in-kernel implementations.

The reason exFAT is a second class citizen on Linux is that Microsoft asserts many patents on exFAT, and implementing support for it requires a license from Microsoft.

UDF also supports POSIX file system permissions.

Linux on the Mac — state of the union

Posted Dec 10, 2016 10:59 UTC (Sat) by johannbg (guest, #65743) [Link]

s/maybe/are/ some non-mainline in-kernel implementations like [1].

1. https://github.com/dorimanx/exfat-nofuse

Linux on the Mac — state of the union

Posted Dec 12, 2016 12:39 UTC (Mon) by ismail (subscriber, #11404) [Link]

How do you format your drives? Whenever I try to format a usb disk with UDF, windows (8,10) complains that it's unformatted.

Linux on the Mac — state of the union

Posted Dec 12, 2016 12:51 UTC (Mon) by cortana (subscriber, #24596) [Link]

I recall reading somewhere that Windows will only recongize a UDF filesystem if it's on the first partition on a USB disk, and Mac OS only recognizes it if the whole disk is itself formatted with UDF.

Linux on the Mac — state of the union

Posted Dec 12, 2016 15:07 UTC (Mon) by jem (subscriber, #24231) [Link]

This is a problem if you want to use the same disk on Windows, OS/X and Linux. There is an ugly hack to make the disk usable on all three systems: create the file system on the whole disk, then write a partition table with a partition that starts at sector 0. The UDF file system leaves some space unused at the start of the container it is in (disk or partition), which can be used for the MBR containing the partition table. This way the UDF file system appears to be both on the whole disk and in the first partition.

I found this solution on a blog a long time ago, and haven't tried it recently so I don't know if it still works. Even without the trick, the UDF disk should be portable between Linux and one of Windows (partitioned) and Mac (whole disk).

https://web.archive.org/web/20130313095817/http://sipa.ul...

Linux on the Mac — state of the union

Posted Dec 2, 2016 19:36 UTC (Fri) by flussence (subscriber, #85566) [Link]

This whole situation sounds like all the Compaq computers from the 90s/early-00s I've seen — a thin veneer of “look, I'm a Windows-compatible PC!” over a twisted wreckage of non-standard form factors and firmware. Partially on-disk firmware too, so if that ever had an accident you were left with a large paperweight.

IIRC, Compaq lost the war against ATX.

Linux on the Mac — state of the union

Posted Dec 2, 2016 21:57 UTC (Fri) by bronson (subscriber, #4806) [Link]

Phenomenal article. Very inspiring.

I'm surprised onboard display controllers don't support passthrough. It seems like that wouldn't take much silicon (except for the I/Os) and it would be a much simpler and cheaper architecture than the custom messes everyone is currently implementing.

I suppose there are two problems... 0. you might not want your powerful GPU to pass through the the cheapo chipset GPU, and 1. there's not enough demand to force nVidia and Intel to work together.

Back in the day, we thought dual-ported VRAM was snazzy. I say, dual-port the GPUs! Heck, daisy chain them.

Linux on the Mac — state of the union

Posted Dec 3, 2016 21:37 UTC (Sat) by zlynx (guest, #2285) [Link]

It seems to me that Optimus / PRIME is already a pass-through solution. Instead of custom hardware it is sending the video buffer over PCIe to the GPU with the output on it. And it seems to me that we have this working pretty well these days.

Linux on the Mac — state of the union

Posted Dec 3, 2016 22:31 UTC (Sat) by bronson (subscriber, #4806) [Link]

Good point. If PCIe has the bandwidth and latency, then I'm happy to consider it a virtual passthrough.

It's hard to picture it being sufficient for a 4K or 5K monitor... but busses these days are pretty amazing.

Linux on the Mac — state of the union

Posted Dec 3, 2016 23:24 UTC (Sat) by excors (subscriber, #95769) [Link]

DisplayPort 1.3 apparently does around 26 Gbit/s, which is enough for 5K 60Hz. Modern NVIDIA GPUs support PCIe 3.0 x16, which is about 126 Gbit/s. That sounds like it should be plenty.

Linux on the Mac — state of the union

Posted Dec 4, 2016 18:29 UTC (Sun) by bronson (subscriber, #4806) [Link]

I agree, it seems possible, especially since the hardware was made for gamers. But I don't think that PCIe supports bandwidth reservations does it? Display traffic is scary finicky, and more throughput doesn't cure latency problems.

If it can do seamless 60Hz 5K PCIe-passthrough while the CPU is pegged and some bursty disk/network I/O is going on, then I'll buy it. Especially with an external monitor or two plugged in.

Linux on the Mac — state of the union

Posted Dec 11, 2016 1:56 UTC (Sun) by aaahaaap (guest, #112900) [Link]

> Apple is the only remaining vendor to build a multiplexer into hybrid graphics laptops, which have both high-end and low-power GPUs. The multiplexer allows the panel to be switched between the GPUs and the unused GPU to be powered off. All other manufacturers use a "muxless" solution, whereby the discrete GPU is headless and copies rendered data over PCIe into the integrated GPU's framebuffer. "Muxed" solutions, such as the one used by Apple, offer superior power saving and latency, but are more difficult to implement.

Where does the XPS15 (9550) stand in this regard? Since it's discrete GPU can apparently be fully disabled, even when using HDMI (see https://bbs.archlinux.org/viewtopic.php?pid=1675168#p1675168), how could Apple's solution be more efficient?

Linux on the Mac — state of the union

Posted Dec 11, 2016 2:13 UTC (Sun) by raven667 (subscriber, #5198) [Link]

Without a mux then only one of the GPUs is be connected to the outputs and that GPU has to always be on, it can't be turned off even if it is the "inactive" one, IIUC.

Linux on the Mac — state of the union

Posted Dec 11, 2016 16:48 UTC (Sun) by l1k (subscriber, #112260) [Link]

Yes, with "muxless" hybrid graphics, the integrated GPU is always on whereas "muxed" solutions need only one of the two GPUs to be on at any given moment. On top of that, muxless requires the frames to be copied over PCIe, so you have higher latency and need to spend additional CPU cycles for fencing to avoid tearing. With Thunderbolt eGPUs latency increases further.

Linux on the Mac — state of the union

Posted Dec 11, 2016 21:22 UTC (Sun) by aaahaaap (guest, #112900) [Link]

I think I understand, thanks for the info!

In my case I'm looking for a decent laptop purely for development, but almost all of them, except for a custom config of the 2015 base model macbook pro 15", have discrete GPUs.
If I understand it correctly in cases where the integrated GPU controls the display outputs I should be able to fully disable the discrete GPU and not incur it's the power usage penalty.

Is there an easy way to figure out to which GPU the display outputs are connected? Maybe the info can be extracted from xrandr and the Xorg + kernel log?

Linux on the Mac — state of the union

Posted Dec 12, 2016 12:42 UTC (Mon) by l1k (subscriber, #112260) [Link]

almost all of them, except for a custom config of the 2015 base model macbook pro 15", have discrete GPUs
The MacBookPro11,4 is the 2015 version without discrete GPU, the MacBookPro11,5 is the one with discrete GPU.
If I understand it correctly in cases where the integrated GPU controls the display outputs I should be able to fully disable the discrete GPU and not incur it's the power usage penalty.
Correct, but that's the case for both muxed and muxless systems. One thing to keep in mind though is that the external DP/HDMI ports can only be driven by the discrete GPU on 2011+ MacBook Pros.
Is there an easy way to figure out to which GPU the display outputs are connected? Maybe the info can be extracted from xrandr and the Xorg + kernel log?
This is e.g. logged in dmesg: "vgaarb: overriding boot device: PCI:0000:01:00.0" (that's the discrete GPU, the integrated is usually 0000:00:02.0). By default the firmware switches to the discrete GPU on boot, but this can be influenced with an EFI variable using tools like gpu-switch (linked in the article) or gfxCardStatus (on macOS). The MacBookPro5 (2008/09, dual Nvidia) is the exception to that rule, it defaults to the integrated GPU.

Linux on the Mac — state of the union

Posted Dec 12, 2016 19:39 UTC (Mon) by aaahaaap (guest, #112900) [Link]

Awesome! Thanks a lot for your help/the info!

Linux on the Mac — state of the union

Posted Dec 17, 2016 12:24 UTC (Sat) by jkt_ (guest, #90352) [Link]

> In my case I'm looking for a decent laptop purely for development, but almost all of them, except for a custom config of the 2015 base model macbook pro 15", have discrete GPUs.

I can recommend Thinkpad T460s -- it works just fine under recent Linux. I have colleagues that are happy with their Dell XPSs without a discrete GPU -- perhaps you're talking about Macs?


Copyright © 2016, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds