From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752482Ab2GTQdZ (ORCPT ); Fri, 20 Jul 2012 12:33:25 -0400 Received: from mail-pb0-f46.google.com ([209.85.160.46]:58229 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751328Ab2GTQdY (ORCPT ); Fri, 20 Jul 2012 12:33:24 -0400 MIME-Version: 1.0 In-Reply-To: <20120720121848.GA29183@aftab.osrc.amd.com> References: <180a06f3f357cf9f78259ae443a082b14a29535b.1342723082.git.tony.luck@intel.com> <20120720121848.GA29183@aftab.osrc.amd.com> Date: Fri, 20 Jul 2012 09:33:23 -0700 X-Google-Sender-Auth: -nRnrEoW1NPnpmKffKnNUAqL6Kk Message-ID: Subject: Re: [PATCH 2/2] x86/mce: Add quirk for instruction recovery on Sandy Bridge processors From: Tony Luck To: Borislav Petkov Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Chen Gong , "Huang, Ying" , Hidetoshi Seto Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > Maybe define a default empty quirk_no_way_out() on the remaining > families/vendors so that the compiler can optimize it away and we save > ourselves the if-test? Perhaps I misunderstood your suggestion. I don't see how the compiler will manage to optimize it all away. I just tried defining static void quirk_no_way_out_nop(int bank, struct mce *m, struct pt_regs *regs) { } and providing that as an initial value for the quirk_no_way_out function pointer. Then I deleted the "if (quirk_no_way_out)". Looking at the assembly code produced, I now just have an unconditional call: callq *0x9fe992(%rip) # ffffffff81a18668 I'd think that a call through a function pointer to an empty function is more expensive that testing whether that function pointer was NULL. -Tony