Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp619890pxk; Wed, 16 Sep 2020 12:24:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuvRqWA7MwPtztnS3/uMDSthoztj19uw74pfpHr9oUuSP4Oi5BYOS1QVY6ZZg4vf5C/2MF X-Received: by 2002:a50:ab13:: with SMTP id s19mr28552679edc.357.1600284263403; Wed, 16 Sep 2020 12:24:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600284263; cv=none; d=google.com; s=arc-20160816; b=0d3hB/3W0gRw1cLB/J+SoLQg3aGQ6PrmHR+xslBo7/XjPAbpjNzcvhC79+LE47j+2a WhifXt1LliMDxywUdkKxFs6ng76BgHQW/HXTZvDpqilP6yvPyuQCJ20ketdFSi3O24j2 3GalrFcardBccg+zS1Ug57MoD4RWPjoYAKj1aMWAYxrONRf7jFUN3PjXSTnf5NKBiILT mCTiI/1WsSi3j+KRCrbuDUyUpIgbugSpuHiOMe94QsjCtjg72U/jherDlVyC8bYoTy8W hNm9P5APQU7HSxHXhuCLNoNItSpbaUlFA1nimp1BG4/UIvzT9XhjaTXqFZ/p8/30imMf 9Etg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=4G92LblP+1H6oAa+GVhgexdhtGi8dq80NdTtJ+rzVQk=; b=AATCEi7jKcwbw7zBmOCpgMm8CvHZ6FWRRxVsOT+wBc060mBGUgdhCf7v1yHeiRDN59 Uxd12a+5GXe0bWQX+iPw2bJT0Iibxy7m1SByu93NV4T7/fx7jeFl4NVTD5EkXMh8pfOu 2NwMRAvqXsPv3SCJLiiJXYrhEP4WNoGSy9nuWP3IJ4WqaGFhmyJpaaTp1HjkEWFYRU1B Kq8nDFWRearX4o2QSFY+7akn7hXkn39vFMs4exUhYlpv3uua/tKzABmETMA1m5LIxzYz OfCdEf6Ub/ZSMhZXaB5VRWwLf28KDQ6nx4m5sBadTZB/0GicShjCSzPCqZLaxsp6uVys cLNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=XCYTBjds; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v6si12502115edt.456.2020.09.16.12.24.00; Wed, 16 Sep 2020 12:24:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=XCYTBjds; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727965AbgIPTWA (ORCPT + 99 others); Wed, 16 Sep 2020 15:22:00 -0400 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:33392 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727430AbgIPTTy (ORCPT ); Wed, 16 Sep 2020 15:19:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1600283993; x=1631819993; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=4G92LblP+1H6oAa+GVhgexdhtGi8dq80NdTtJ+rzVQk=; b=XCYTBjdsdiShTUQyuL95RBx9DWJFdiajQcRisaDc/CJvV7RZ/bK88UuY VgM6enNw0tyoroNh8aMlUyqldPVwEYFElckafT/lvLXMQjS8IqPyi2Rj3 bEc+T62h9gaUbV29yOYG8wASdrUkMbXPUMDS/2pHgRzBgyN5FZQWWJXnr w=; X-IronPort-AV: E=Sophos;i="5.76,434,1592870400"; d="scan'208";a="75575499" Received: from sea32-co-svc-lb4-vlan3.sea.corp.amazon.com (HELO email-inbound-relay-2b-4e24fd92.us-west-2.amazon.com) ([10.47.23.38]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP; 16 Sep 2020 19:16:04 +0000 Received: from EX13MTAUWC002.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2b-4e24fd92.us-west-2.amazon.com (Postfix) with ESMTPS id 0698DA1817; Wed, 16 Sep 2020 19:15:59 +0000 (UTC) Received: from EX13D20UWC001.ant.amazon.com (10.43.162.244) by EX13MTAUWC002.ant.amazon.com (10.43.162.240) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 16 Sep 2020 19:15:59 +0000 Received: from freeip.amazon.com (10.43.161.146) by EX13D20UWC001.ant.amazon.com (10.43.162.244) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 16 Sep 2020 19:15:55 +0000 Subject: Re: [PATCH v6 1/7] KVM: x86: Deflect unknown MSR accesses to user space To: Sean Christopherson CC: Aaron Lewis , Paolo Bonzini , Jonathan Corbet , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , "Joerg Roedel" , KarimAllah Raslan , "Dan Carpenter" , kvm list , , References: <20200902125935.20646-1-graf@amazon.com> <20200902125935.20646-2-graf@amazon.com> <186ccace-2fad-3db3-0848-cd272b1a64ba@amazon.com> <20200916170839.GD10227@sjchrist-ice> From: Alexander Graf Message-ID: Date: Wed, 16 Sep 2020 21:15:53 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.2.2 MIME-Version: 1.0 In-Reply-To: <20200916170839.GD10227@sjchrist-ice> Content-Language: en-US X-Originating-IP: [10.43.161.146] X-ClientProxiedBy: EX13D45UWB001.ant.amazon.com (10.43.161.115) To EX13D20UWC001.ant.amazon.com (10.43.162.244) Content-Type: text/plain; charset="windows-1252"; format="flowed" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 16.09.20 19:08, Sean Christopherson wrote: > = > On Wed, Sep 16, 2020 at 11:31:30AM +0200, Alexander Graf wrote: >> On 03.09.20 21:27, Aaron Lewis wrote: >>>> @@ -412,6 +414,15 @@ struct kvm_run { >>>> __u64 esr_iss; >>>> __u64 fault_ipa; >>>> } arm_nisv; >>>> + /* KVM_EXIT_X86_RDMSR / KVM_EXIT_X86_WRMSR */ >>>> + struct { >>>> + __u8 error; /* user -> kernel */ >>>> + __u8 pad[3]; >>> >>> __u8 pad[7] to maintain 8 byte alignment? unless we can get away with >>> fewer bits for 'reason' and >>> get them from 'pad'. >> >> Why would we need an 8 byte alignment here? I always thought natural u64 >> alignment on x86_64 was on 4 bytes? > = > u64 will usually (always?) be 8 byte aligned by the compiler. "Natural" > alignment means an object is aligned to its size. E.g. an 8-byte object > can split a cache line if it's only aligned on a 4-byte boundary. For some reason I always thought that x86_64 had a special hack that = allows u64s to be "naturally" aligned on a 32bit boundary. But I just = double checked what you said and indeed, gcc does pad it to an actual = natural boundary. You never stop learning :). In that case, it absolutely makes sense to make the padding explicit = (and pull it earlier)! Alex Amazon Development Center Germany GmbH Krausenstr. 38 10117 Berlin Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B Sitz: Berlin Ust-ID: DE 289 237 879