Messages in this thread | | | Date | Tue, 31 Jan 2023 14:54:03 -0800 | From | Ashok Raj <> | Subject | Re: [Patch v3 Part2 1/9] x86/microcode: Taint kernel only if microcode loading was successful |
| |
On Tue, Jan 31, 2023 at 09:20:37PM +0100, Borislav Petkov wrote: > On Tue, Jan 31, 2023 at 08:51:25AM -0800, Ashok Raj wrote: > > remove ret = 0 during initialization since its cleared right below. (tglx) > > Sure. > > > Need to set ret explicitly to either -EINVAL, or size. Otherwise it will be > > endlessly waiting for write to complete. (As Aubrey pointed out) > > Then do: > > tmp_ret = microcode_ops->request_microcode_fw(bsp, µcode_pdev->dev); > if (tmp_ret != UCODE_NEW) > return size; > > to signal what it is. It certainly ain't an error if it doesn't find new > microcode.
It's not an error, only when request_microcode() returns UCODE_ERROR, should it return -EINVAL, if its UCODE_NFOUND, or otherwise the code should treat as success.
The diff I attached was: https://lore.kernel.org/lkml/Y9lHDWjjnqdletL3@a4bf019067fa.jf.intel.com/
if (tmp_ret != UCODE_NEW) - return ret; + return (tmp_ret == UCODE_ERROR ? -EINVAL : size);
Does the above look fine?
> > > I think its safe to leave ret as is, since microcode_reload_late() only > > returns -1, or 0. > > No it doesn't. Hint: stop_machine_cpuslocked(). > > > Pull this into the ret == 0, so taint only if the update was successful? > > Ok. > > > And add a message so its not silent? > > You'd add a printk for every possible operation, wouldn't you?
:-) Not like that.. But looking through most of the cases that does add_taint() either have some print, or there some big spalt message around it.
This shouldn't be noisy, but if you think this isn't needed, it can go away.
> > See, the world doesn't revolve around microcode loading. If that thing > fails, then someone has done a bad job at the CPU vendor testing, > provided the code does the right thing. >
When it fails due to current_rev < min_rev, Isn't it good to add indication to user space that it didn't succeed? Thomas wanted these return codes, so someone scripting can get a status after an attempt to load.
Otherwise agree, it shouldn't generally fail.
| |