Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3757531imu; Fri, 30 Nov 2018 05:39:38 -0800 (PST) X-Google-Smtp-Source: AFSGD/WlJunANBKnIwv9RJE05Il+qr1LcTolIbVErJ83XU347bKI2QFMgaavbv6I/VhDHu/Fjkud X-Received: by 2002:a65:5bc4:: with SMTP id o4mr4991787pgr.426.1543585178008; Fri, 30 Nov 2018 05:39:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543585177; cv=none; d=google.com; s=arc-20160816; b=vbxGE0aSj5zoUwQOez4/oXRzlZIwU6H6D3RvtuyJjntgJhySbsEngh8wMtkkInf8HD 5lH9iW4FfKtUFLF/7q/yYL3eZi6Ri43EZlV8Ved3xn0r+hMRyrzhzLmAmBvZH0xct8x0 +FO7xphCYL+FTLtpu8h/p4HdEaqlS97aP87jvCu/g5LFIQNCiH7dOHG0BHAB99l6h5ok X4iwMLJqs+YCCVohPrwdTa1iIvAP0sBBJ0bjrXkEOQwFZE1ap3mMiFoTTPi6V8twyPjf /ydM46B7Wehws8SwN+tj6q7o0pQ4j86YDM9vK/13CKfLZxOyujaZU9rqlqN0lOOvcqHi q8lw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=YztdLmYgScPmjRvVh06LGIiokyurGdnwj+ibH7x9fk4=; b=lwuDDFzEA+rj4Jy5nzFaIAO1x8CSkHa2JFOlaihS2eCLZkKjyXFEh9yWWxcCFmaLxL E1A1/mUz0PUOAhN+toelEnh1WiqSVXsacHKydUHn/yj0XGVPMlxHbLKuQE9ROzaBYBFa GZdh6MID5D266PfYkZIqC5pP8zJAFoX+C8YZeNh8u/JqRwlc/G9wXxRU8jliwLSAmECL TSqj87j/ThHBrFrl4z+LiHGDGBtMhrqb6JkjVZ0HbSVd4uA4vZuMNnl7C1dnyQ9TYVY7 kDbHd6Vv2qeHTAfV/IpSYIsuCyB0iqmfXQTXWVteG0etspXlYRiulAvwzyrZciqj7V7h 8MUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 128si5730009pfe.4.2018.11.30.05.39.21; Fri, 30 Nov 2018 05:39:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726746AbeLAAsA (ORCPT + 99 others); Fri, 30 Nov 2018 19:48:00 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:37573 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725928AbeLAAsA (ORCPT ); Fri, 30 Nov 2018 19:48:00 -0500 Received: from hsi-kbw-5-158-153-52.hsi19.kabel-badenwuerttemberg.de ([5.158.153.52] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gSj09-0004FD-Ck; Fri, 30 Nov 2018 14:38:37 +0100 Date: Fri, 30 Nov 2018 14:38:36 +0100 (CET) From: Thomas Gleixner To: Roman Kagan cc: Vitaly Kuznetsov , "kvm@vger.kernel.org" , Paolo Bonzini , =?ISO-8859-2?Q?Radim_Kr=E8m=E1=F8?= , "linux-kernel@vger.kernel.org" , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , "x86@kernel.org" , "Michael Kelley (EOSG)" , Nadav Amit Subject: Re: [PATCH] x86/hyper-v: define structures from TLFS as packed In-Reply-To: <20181130131122.GA2358@rkaganb.sw.ru> Message-ID: References: <20181130121511.12331-1-vkuznets@redhat.com> <20181130131122.GA2358@rkaganb.sw.ru> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 30 Nov 2018, Roman Kagan wrote: > On Fri, Nov 30, 2018 at 01:15:11PM +0100, Vitaly Kuznetsov wrote: > > Without 'packed' compiler is free to add optimization paddings and re-order > > structure fields for randomization/optimization. And structures from > > hyperv-tlfs.h are used for hypervisor-guest communication, we need to > > ultimately forbid such practices. > > Note that __packed also reduces the structure alignment to 1, which is > not necessarily what you want. > > E.g. some of these structures are passed by pointer to the hypercall, > which requires its arguments to be 8byte-aligned. I'm also not sure > that passing unaligned argument to [rw]msr is ok, need to double-check. If you have alignment requirements then you need to express them too. Thanks, tglx