From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57A7FC433F5 for ; Sat, 19 Mar 2022 13:24:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243031AbiCSNZh (ORCPT ); Sat, 19 Mar 2022 09:25:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239627AbiCSNZe (ORCPT ); Sat, 19 Mar 2022 09:25:34 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 094A763B9 for ; Sat, 19 Mar 2022 06:24:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647696252; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LAhEbRZv23sg+3l9XeDBt2uA5yTFBx5ccqYfvZx5ss0=; b=a97JRUxzg4CE/rQdpZVSkOdC77qOwAwoB7fRaJ27EMkBWl+3ZHKQ1HcugfZL+YYd7UI6Pf G30eOgp20DeLLnVWNhoL4+LN0GPZW7I6W+DPgR6YRRhliNh7mCjbkubxMJln48Bnl25vlg cKiwazaNyYW0uG8TFd3CN7y0dzVsJ/4= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-445-OuqtuUDNOUKI-A-HMvErJw-1; Sat, 19 Mar 2022 09:24:10 -0400 X-MC-Unique: OuqtuUDNOUKI-A-HMvErJw-1 Received: by mail-ed1-f72.google.com with SMTP id l24-20020a056402231800b00410f19a3103so6521257eda.5 for ; Sat, 19 Mar 2022 06:24:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=LAhEbRZv23sg+3l9XeDBt2uA5yTFBx5ccqYfvZx5ss0=; b=kyk2DuiRceiQWuai0Q2C5O1cvm6dNE/q/Vm9FQumpEgz9/s+/+T+qdZUZ9Cm6YrmzI zToXUgQ9DWJy+nDRC0HUZ1N4qvUzPr6Izuu0wcPRF9P+itKZ09n/F3OSj0fpiLMEuGi6 1cszu15Q1hYKBLpoV4q/FJgT21f+t172dD+6yI5fDSsp303laLvoHrLgfoInqz8KKBzz YS3EJVmcnW2kVgD8efbMicZ5BL/tmAu5dKeGG/O1V5vk+DiTA/jDbh8de1FmWvi/j6PT 5aZ3CMEOIk/haenu/mjDcpFFNU5DhDPOJ3ECZW+j+1NjcUDOmokygsP87dBG9DH7ClUd kpLA== X-Gm-Message-State: AOAM532E7CvGJgjorqjGeVyc5hvgabiwI9zTA8M5EWsO6dF6IDHWii5v RReLpAXcbDH8Ov8716zsrIzvtlB2v0oVdBnlwQjWnHEN+Jq1QgyIUdKYYD0Ij463WEPN773MUNu nWJzC2NgSB8u6cFMoGLjufoSG X-Received: by 2002:a17:907:7704:b0:6cf:48ac:b4a8 with SMTP id kw4-20020a170907770400b006cf48acb4a8mr13161273ejc.305.1647696249796; Sat, 19 Mar 2022 06:24:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx8NFkT0ysq1q8SRtiCqUI2HWoJCMvPL0kr0rqzwobrsp24Q4Cv2FXmntZ0YbvOSbdqUcjf6A== X-Received: by 2002:a17:907:7704:b0:6cf:48ac:b4a8 with SMTP id kw4-20020a170907770400b006cf48acb4a8mr13161251ejc.305.1647696249538; Sat, 19 Mar 2022 06:24:09 -0700 (PDT) Received: from ?IPV6:2001:b07:6468:f312:63a7:c72e:ea0e:6045? ([2001:b07:6468:f312:63a7:c72e:ea0e:6045]) by smtp.googlemail.com with ESMTPSA id q2-20020a170906144200b006ceb8723de9sm4781578ejc.120.2022.03.19.06.24.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 19 Mar 2022 06:24:08 -0700 (PDT) Message-ID: <94df38ce-6bd7-a993-7d9f-0a1418a1c8df@redhat.com> Date: Sat, 19 Mar 2022 14:24:06 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH -v1.2] kvm/emulate: Fix SETcc emulation function offsets with SLS Content-Language: en-US To: Peter Zijlstra , Borislav Petkov Cc: Jamie Heilman , linux-kernel@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Dave Hansen , x86@kernel.org, Sean Christopherson , kvm@vger.kernel.org References: <20220316220201.GM8939@worktop.programming.kicks-ass.net> From: Paolo Bonzini In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/17/22 12:04, Peter Zijlstra wrote: > Acked-by: Peter Zijlstra (Intel) > > Depending on what Paolo wants, it might make sense to merge this into > tip/x86/urgent such that we can then resolve the merge conflict vs > tip/x86/core with something like the below: Sorry for responding late, I was sick the past few days. Go ahead and apply it to tip/x86/core with the rest of the SLS and IBT patches. If you place it in front of the actual insertion of the INT3 it will even be bisectable, but I'm not sure if your commit hashes are already frozen. Just one thing: > -#define SETCC_ALIGN (4 * (1 + IS_ENABLED(CONFIG_SLS))) > +/* > + * Depending on .config the SETcc functions look like: > + * > + * setcc: > + * +0 ENDBR [CONFIG_X86_KERNEL_IBT] > + * +4 SETcc %al > + * +7 RET > + * +8 INT3 [CONFIG_SLS] > + * > + * Which gives possible sizes: 4, 5, 8, 9 which when rounded up to the > + * next power-of-two alignment become: 4, 8, 16. > + */ > +#define SETCC_ALIGN (4 * (1 + IS_ENABLED(CONFIG_SLS)) * (1 + HAS_KERNEL_IBT)) This might be slightly nicer as (4 << IS_ENABLED(CONFIG_SLS) << HAS_KERNEL_IBT. Or maybe not, depends on your taste. It might also be worth doing: #define SETCC_LENGTH (4 + IS_ENABLED(CONFIG_SLS) + 4 * HAS_KERNEL_IBT) #define SETCC_ALIGN (4 << IS_ENABLED(CONFIG_SLS) << HAS_KERNEL_IBT) BUILD_BUG_ON(SETCC_LENGTH <= SETCC_ALIGN); Thanks, Paolo