On 04/04/2025 8:48 am, Jan Beulich wrote: > On 03.04.2025 19:57, Andrew Cooper wrote: >> Bloat-o-meter reports: >> >> add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-29 (-29) >> Function old new delta >> _probe_mask_msr 99 94 -5 >> init_amd 2418 2394 -24 >> >> but that's because .fixup doesn't contain sized/typed symbols. This also >> drops two "mov -EFAULT, %reg; jmp ...;" sequences too. The net saving is >> -50. >> >> wrmsr_amd_safe()'s return value is only checked against 0 (if at all), and >> because of this, the compiler can now avoid manifesting 0/-EFAULT entirely, >> and the %[fault] label simply lands on the right basic block. >> >> Convert to Xen style while rewriting. >> >> No functional change. >> >> Signed-off-by: Andrew Cooper <andrew.coop...@citrix.com> >> --- >> CC: Jan Beulich <jbeul...@suse.com> >> CC: Roger Pau Monné <roger....@citrix.com> >> >> Slightly RFC. We use -EIO elsewhere for this purpose, and nothing in this >> logic cares. > {rd,wr}msr_safe() both use -EFAULT. What's "elsewhere" here?
Oh, that would be Linux. Sorry, too much time spent staring at the same logic in different codebases. > >> I was pleasently surprised by the manifestation of -EFAULT going away >> entirely. > I fear I don't understand this, given the -EFAULT is still there in the > new code. I meant about what the optimiser can do. It hadn't occurred to me that that was a valid transformation. > > Irrespective of these remarks: > Reviewed-by: Jan Beulich <jbeul...@suse.com> Thanks. ~Andrew