HNHacker News
TopNewBestAskShowJobs

marcan_42

11,384 karma · joined December 5, 2017

submissionscomments
marcan_42··on The magic of the Japanese convenience store sandwich
I've lived for 8 years in Japan and haven't had a single incident of xenophobia at a konbini.

Though I will say I got a chuckle out of the ojisan who threw a perfect Microwaveでwarmしますか? at me once :-)

marcan_42··on Alpine Linux: Brilliant Linux Distro
Compiling is CPU-bound and doesn't really bottleneck on anything that libc is involved with other than the allocator, so unless musl's allocator is comically slower than glib's, chances are it's just -Os.
marcan_42··on A Chip to Bridge the USB 2 – USB 3 Divide
Definitely still buggy; I know for a fact it still oopses when certain USB things go wrong, which is by definition a bug.
marcan_42··on A Chip to Bridge the USB 2 – USB 3 Divide
The device is buggy and the kernel is buggy. The device is buggy because it did something stupid; the kernel is buggy because it crashed in response. That's two independent bugs. Sometimes it isn't even buggy devices, just devices disconnecting at the wrong time. I've crashed my kernel with things as simple as devices rapidly reconnecting or simply ceasing to respond/timing out.

Most of the kernel bugs around this are state/race issues. Device disappears in the middle of kernel code that doesn't have proper error recovery, boom. That's a kernel bug that applies in normal circumstances too, not just under an adversarial device model, because USB is designed to be hotpluggable at any time. Doesn't matter if the device disappeared because it crashed or because the user yanked the cable; it's just easier to reproduce with a crashy device. And the error recovery logic is notoriously hard to get right, which is why I'm not surprised the kernel is still buggy after all these years.

marcan_42··on A Chip to Bridge the USB 2 – USB 3 Divide
> I’d be willing to bet my life that the kernel’s more than a decade old and globally deployed XHCI implementation is not the cause of his USB issues.

I wouldn't, because I've found and fixed bugs in the kernel's xHCI implementation, and I still regularly panic or oops my kernel with dodgy USB devices, which is by definition a kernel bug (and a security one at that). USB is an overcomplicated standard and extremely difficult to implement properly.

> Is it technically possible that usbmon will say that it sent proper data to the device when in fact it didn’t due to a bug in the kernel XHCI stack? Yes it is. Is it likely? very much not.

As someone who works with USB regularly, I very much disagree with your assessment.

> Usbmon was invented for this exact use case: debugging usb issues under the assumption that there is no fault in the kernel’s usb stack.

Usbmon was invented for debugging USB issues with a single device, under the assumption that there is no fault with the kernel's USB stack and the controller. Once you're having controller-global issues that could be caused by either of those, usbmon is not useful because that assumption no longer holds.

> Basic intuition tells us it’s a hardware issue, either controller, hub, or device.

We clearly have very different intuitions here. I would absolutely split my bets on it being a controller or kernel issue.

marcan_42··on A Chip to Bridge the USB 2 – USB 3 Divide
I don't know how you plan to tell apart kernel xHCI driver bugs from xHCI controller bugs with usbmon, which has nothing to do with the xHCI layer. It's at a higher layer. It doesn't show you anything related to xHCI internals. You can't know if any given behavior came from the HC or the kernel, what happened really, or anything else.

Source: I wrote the virtual xHCI implementation in QEMU (and worked around broken Windows drivers in it), I have experience with this.

marcan_42··on The day Steve Jobs dissed me in a keynote (2010)
Audio CDs do have framing information (in the subchannel). However, the subchannel has no error correction (only basic error detection), so the CD player has to interpolate across subchannel errors (which are normal and common) to figure out where it is, and doing that properly can get complicated.

Also, the audio frame size is 2352 bytes. Those correspond to 2048 data bytes for data CDs (plus extra error correction).

marcan_42··on A Chip to Bridge the USB 2 – USB 3 Divide
It won't, because you can't know if the misbehavior is caused by a device or the host controller when you're looking behind the host controller. Everything you see in usbmon is influenced by both. And besides, a malfunctioning device can't cause your entire USB controller to bork; that indicates a bug in the USB controller or its driver by definition, making usbmon inherently unreliable in that scenario.
marcan_42··on A Chip to Bridge the USB 2 – USB 3 Divide
You cannot diagnose/debug host controller hardware/driver issues with usbmon. It does not work at a low enough layer. It's only good for debugging issues with downstream devices. You also cannot tell whether certain problems are the host controller's fault or the downstream device's fault with it. You need a physical USB protocol analyzer that works at the packet level for that (usbmon works at the transaction level).
marcan_42··on Apple M1 Ultra
All of them. The CPU graph is pegged for most of the compilation.
marcan_42··on Apple M1 Ultra
I've been saying 4x M1 Max is not a thing and never will be a thing ever since the week I got my M1 Max and saw that the IRQ controller was only instantiated to support 2 dies, but everyone kept parroting that nonsense the Bloomberg reporter said about a 4-die version regardless...

Turns out I was right.

The Mac Pro chip will be a different thing/die.

marcan_42··on Apple M1 Ultra
My 1st gen 16 core Threadripper is barely faster than an M1 Pro/Max at kernel builds, so a 64 core TR3 should handily double the M1 Ultra performance.

But you know, I'm still happy to double my current build perf in a small box I can stick in my closet. Ordered one :-)

marcan_42··on Interactively edit individual DCT blocks in any JPEG image in the browser
Better entropy coding. TL;DR JPEG and other "lossy" compression formats are two steps: the lossy step and a lossless step like ZIP. You keep the lossy step as-is and improve the lossless step.
marcan_42··on A Chip to Bridge the USB 2 – USB 3 Divide
A single USB xHCI controller is not bottlenecked to 480Mbps globally, since the multiple ports aren't actually sharing a 2.0 physical layer. The "root hub" isn't like a normal hub in that sense. So you don't need a controller per port, as long as the controller is designed to support this.

Quoting the xHCI spec:

> In past generations of USB host controller implementations, there was a 1:1 correspondence between a host controller interface and USB bandwidth. The xHCI diverges from this model in that it enables vendors to tailor the bandwidth available through its root hub ports to the needs of the vendor’s target application space. The xHCI can support the legacy model where the bandwidth of a single USB is shared across all its root hub ports, a “bus per port” model where the full bandwidth of a USB is available on every root hub port, or any combination in between.

I believe most real 3.0 implementations do it per port, or at least have a bunch of instances, because it doesn't really make any sense to do otherwise. You're not really saving much money by somehow having a global bottleneck equal to the PHY bandwidth. Of course, it's possible for the controller to be bottlenecked upstream in some other way (e.g. by DMA bandwidth), but it would be very weird to find an xHCI controller with a single 480Mbps domain for all 2.0 ports IMO.

marcan_42··on A Chip to Bridge the USB 2 – USB 3 Divide
> For a while, I do not believe the USB transaction translator[1] was not totally commonplace: I remember articles specifically highlighting which usb2 hubs had this feature.

You are misremembering. All 2.0 hubs have TTs. The question is whether they have one (same problem as USB3, all ports share a single 12Mbps pipe in 1.0 mode) or multiple (can aggregate multiple 12Mbps devices without bottlenecks). What USB3/4 have done is doom us to a world equivalent to multi-TT hubs not existing. Except it's worse because with single TT hubs, at least you can still chain multiple to a parent hub and aggregate without bottlenecks at that level.

> Once we start adding isosynchronous profiles & perhaps various other usb2 gimmicks, I imagine the transaction translation problem becoming much more thorny

Thorny, perhaps. Impossible, no. This is trivial to prove: sticking a PCI USB2 host controller behind a Thunderbolt/USB4 bridge works fine, and that is for all intents and purposes a USB2 to TB/PCIe "transaction translator", and PCIe itself is more like Ethernet and can be tunnelled over almost anything. The USB host transaction layer (which is a pretty 1:1 map to xHCI) is tunnelable just fine (this is how USB over the network protocols work too, with host support). It's the wire layer that isn't, because once you drop to that layer you can't reconstruct or control the original transaction states properly. What USB2 did for TTs is extend the protocol in such away that the missing information/cases could be handled properly, with cooperation from the host. There's no reason why they couldn't have done this for USB2 to 3 too.

> Making a hub that passes through usb4, but which also exposes a variety of simple peripherals is much easier without mandating the transaction translator.

As I said, they could still keep the USB 2 lines. Having TT support in the standard doesn't mean hubs have to implement it. We'd still have the differentiation between TT-ful and TT-less hubs if you want. The problem is, right now, TT-ful USB3 hubs aren't possible. I agree that having the 2.0 lane in Type C makes a ton of sense. Just let me tunnel it over the SS lanes too!

Source: I've written USB support for projects way too often, including a bare-bones OHCI driver once. I also authored the virtual xHCI implementation in qemu.

marcan_42··on A Chip to Bridge the USB 2 – USB 3 Divide
And the reason why that doesn't and can't work with USB2 is because, unlike Ethernet, USB is extremely closely tied to its physical layer and you cannot actually buffer and switch USB packets at all (without cooperation from at least one side). All communications are host-driven and stateful, and the timeouts for replies are on the order of single-digit microseconds, and the receiving end has no obligation to accept data, so there is no way to safely buffer data and forward it at a later time because that time might never come, and the mere act of accepting data from one end desyncs both ends' ideas of what data was successfully transferred, which can have higher level protocol implications. USB is a clusterfuck of a standard.
marcan_42··on A Chip to Bridge the USB 2 – USB 3 Divide
What USB-IF should have done is specify USB3 to USB2 and USB4 to USB2 transaction translation, like they did for USB2->USB1. It doesn't mean they need to get rid of the USB2 wires, but it means utilizing the 5Gbps+ USB3 bandwidth to host multiple downstream USB2 devices without bottlenecks would be at least possible, and you can always fall back to USB2 hub mode if USB3 is not available.

By refusing to make that part of the spec, they have doomed us to always being limited to a total of 480Mbps per host port for USB2 devices, no matter what you do or how many you have sharing it, whether that host port is USB3 or USB4 (unless you use PCI mode). That is ridiculous.

marcan_42··on A Chip to Bridge the USB 2 – USB 3 Divide
That's better, because with the PCIe layer and a real host controller on the dock/hub, you finally get 480Mbps per port for USB downstream devices. Thunderbolt hubs are the only standards-compliant way to do this, today.

USB4 with native USB3 tunneling but no native USB2 tunneling is a regression over TB3, and as silicon switches from the TB3 way to the USB4 way with native tunneling, we're now bringing back this problem, all thanks to the USB-IF's incompetence at designing standards. There is absolutely no reason for USB3 and USB4 not to support USB2 encapsulation/transaction translation the same way USB2 did with USB1.

marcan_42··on A Chip to Bridge the USB 2 – USB 3 Divide
Both of those ways are what I said, done in different ways. PCI-in-USB3 is not a standard protocol. No matter what you do, there is no way to make it work within standard class protocols only.

> There's two other ways. One is to use a USB 3 to PCI express bridge and then functional pcie USB controller chipsets. I'm not aware of any such bridge silicon existing.

Not USB3, but this is what Thunderbolt docks/hubs do, use embedded PCI USB host controllers for the downstream ports. Which is great! But not for long: the USB-IF took over Thunderbolt and surprise surprise! USB4 includes a new USB3 tunneling mechanism but still not USB2. Yes, really. USB4 docks are expected to still have a ridiculous sidecar USB2 hub just handling USB2 duties and squeezing all that traffic into the USB2 lane all the way to the host. Because that makes sense. Of course, since PCI tunneling is still a thing and standard in USB4, at least you can ignore that nonsense and keep doing it the Thunderbolt way, but I think we're going to see fewer and fewer solutions that do it this way, and USB4 docks which do USB3 tunneling and USB2 passthrough will be a regression over TB3 docks that include full host controllers. You can thank the USB-IF for this.

> The second way is what you said, to skip the bridge and create a USB host controller that connects though via USB. Again, I'm not aware of the existence of any such silicon.

Such silicon exists, I just can't find it right now. It's another very niche thing in a similar vein to the VL67x from another manufacturer.

marcan_42··on A Chip to Bridge the USB 2 – USB 3 Divide
It is impossible to implement that. The USB standard for some inexplicable reason refused to specify USB 3 to USB 2 transaction translation. That's why it doesn't exist. There is no way to implement it that works as you would expect. It's just not possible. I will never forgive the USB-IF for this gaffe, it is ridiculous.

There are two nonstandard ways to do it. One is what this chip does, which is pretend all USB 2 devices behind it are USB 3. It literally virtualizes and rewrites desctiptors and does a whole pile of horrible hacks to get it to work. It works most of the time, but not always, and it is actually impossible to make it 100% reliable due to peculiarities of the standard. USB is impossible to tunnel or masquerade transparently at the link level due to its design, and since this device tries to do that to bridge incompatible link types, it can never be 100% spec compliant; there will always be corner cases where it breaks down. It's a hack.

The other way, which is implemented by some other niche hub chip whose name I forget, is to use a proprietary protocol to encapsulate USB2 in USB3, effectively making a USB2 host controller that just happens to connect to the host CPU via USB3. That can be done in a 100% spec-compliant and reliable way as far as downstream devices go, but then of course the upstream side is not standard, so you need special drivers for it.

There will never be a USB 2 to USB 3 translating hub that works as you'd expect because it's just not possible to build one, because the USB-IF are notoriously bad at designing standards. Seriously, so much about USB is a giant clusterfuck, from USB2's differential-but-not-really physical layer to the monster that is USB-PD.

marcan_42··on Unofficial yet comprehensive FAQ for LoongArch
> with the replacement of the copyright headers being among the largest changes in some cases

I'm surprised they let that fly. Removing existing copyright headers from code you copy wholesale is a very bad idea, even if the license is compatible. Especially if you're making a copy as a new file, so there is no Git history to trace past authorship.

marcan_42··on How “latency numbers everybody should know” decreased from 1990–2020
Yeah, I was wondering where the heck 2ms disk seek times came from. That's not a thing and will never be a thing; disks only spin so fast, and nobody even uses >7200RPM drives any more (because we've all moved to SSDs instead).
marcan_42··on Milky Way and Andromeda galaxies are already merging (2020)
Yup, all stars other than the Sun are below our ability to resolve as anything other than a point, so they do indeed look dimmer than the Sun to us.

The inverse square law always applies, but it relates to the total amount of light received by a constant area observer (or density at a pointlike observer). Once you're projecting the image of the source onto a plane with a lens, that doesn't map to surface brightness.

Another place where the inverse square law breaks down is with beams of light, in the near field - consider something like a laser beam. While it will expand, and eventually follow the law once you get far enough, it very much doesn't at close range. And there's an interesting parallel here: to an observer, a collimated laser beam looks like a perfect pointlike object at infinity (modulo the diffraction limit, of course). Another way to see it is that focusing a beam of light in a certain way creates a virtual emitter much further away, and so you need to add that to the distance you plug into the inverse square law.

marcan_42··on Milky Way and Andromeda galaxies are already merging (2020)
> If we reverse the situation the analysis is clearly flawed. The Sun is not a particularly bright star in an absolute sense, but it's extremely bright to us. If you moved it a few hundred AU farther away, it would become difficult to distinguish from the background stars.

You missed my point about pointlike objects.

If you moved the sun 1 AU further away, it would of course cast 1/4 of the total light on the Earth, but as an object in the sky it would have the same surface brightness as it does now. It would just look smaller. I'm talking about the appearance of objects in the sky to a camera-like observer.

Once the distance increases to the point where the human eye cannot resolve it beyond a single point, then brightness starts diminishing with distance. This is the case for all single stars other than the sun. This is not the case for aggregate objects like galaxies that are large enough to see as non-points with the naked eye, like Andromeda, regardless of whether they are composed of individual pointlike stars or not.

marcan_42··on RISC-V is succeeding
It's not about a shifter, it's about determining instruction boundaries. With variable-length instructions the next instruction start depends on the previous one, making it an inherently serial process. Working around that to decode in parallel is not easy and gets superlinearly more complex the wider you make the decoder. A fixed instruction size architecture like ARM64 doesn't have to deal with any of that.
marcan_42··on RISC-V is succeeding
But it does. x86 is hell to decode in parallel, because it's variable length (and in a complex way), so Intel can't build CPUs that keep a wide pipeline fed with instructions efficiently like Apple can, with the 8-wide decoder in the M1. That's one of the things that makes the M1 special, and how it gets away with lower clocks and power consumption than competing x86 designs.
marcan_42··on I enforced the AGPL on my code (2020)
You argued, specifically, that,

> You're modifying the program whether you've touched any files containing plain text source code or not.

And that is just not how copyright works.

(Separately, if you ever find yourself linking to completely unrelated comments by the person you are replying to in order to construct an attack on them personally, then your own argument is probably nonsense, and you're probably not a fun person to have around.)

marcan_42··on Milky Way and Andromeda galaxies are already merging (2020)
Double the distance, you get 1/4 the light. Double the distance, you get 1/4 the solid angle. The surface brightness of the object in your field of view therefore stays constant.
marcan_42··on I enforced the AGPL on my code (2020)
It does not. The copyrighted work is the code for the software, and making modifications means modifying the copyrighted software. Copyright has no notion of "modification" in the sense of changing the final behavior. It's strictly about making changes to the copyrighted work itself.

This is why things can get interesting with binary hooks and patches, which, depending on how they're done, can be argued not to be modifying the copyrighted work (e.g. a hook done via a hardware debug breakpoint does not require making any alterations to the target software per se, in the copyright sense). Similarly, interpreting (e.g. emulating) software is widely understood to be legal since you aren't modifying the underlying software, even if the emulator causes it to behave differently from the original intent.

Of course, then things get murky again with emulation techniques such as JIT, which could be argued to be creating a transient derivative work. Or not so transient, in the case of AOT. I would dare say there is a legal argument to be made that running older x86 Mac apps on an M1 Mac could constitute unauthorized creation of a derivative work (since it outright caches AOT recompiled versions of the apps you run using Rosetta). Of course, this seems stupid from a technical point of view, but I'd love to see if there is prior case law on this kind of situation, where a newly introduced technological mechanism can conceivably cause re-classification of the copyright effects of merely running software. It's certainly a deep rabbit hole to go into.

marcan_42··on I enforced the AGPL on my code (2020)
I'm not relying on the contractual barrier, I'm relying on the interpretation of the clause as applying strictly to the behavior of the program as designed and embodied in the source code, and arguing that there is no moral requirement stated in the license for ensuring that that behavior is ultimately exposed to end users, and in fact, such a requirement would go against the spirit of the AGPL as a copyright license and it was explicitly written not to require that.

Some people might disagree with that interpretation, which is okay because it's the kind of fine point nobody will ever agree on until it ends up in front of a judge. Which is why I bring up the two party example, to sidestep that question.

← PreviousPage 3 of 34Next →