From patchwork Fri Aug 4 05:28:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9880497 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C140A6031B for ; Fri, 4 Aug 2017 05:30:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BD0C8289A2 for ; Fri, 4 Aug 2017 05:30:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B1E8D289A9; Fri, 4 Aug 2017 05:30:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6101B289A2 for ; Fri, 4 Aug 2017 05:30:03 +0000 (UTC) Received: from localhost ([::1]:35728 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddVBS-0007dq-Da for patchwork-qemu-devel@patchwork.kernel.org; Fri, 04 Aug 2017 01:30:02 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36308) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddVAB-0007Tz-FB for qemu-devel@nongnu.org; Fri, 04 Aug 2017 01:28:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ddVAA-0001Ck-KM for qemu-devel@nongnu.org; Fri, 04 Aug 2017 01:28:43 -0400 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]:38826) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ddVAA-0001C4-ET for qemu-devel@nongnu.org; Fri, 04 Aug 2017 01:28:42 -0400 Received: by mail-pg0-x243.google.com with SMTP id 123so778259pga.5 for ; Thu, 03 Aug 2017 22:28:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZTvm9dawsrAvg/0kp+KzEWsiNH8QxHZk2ZLtJWCc5UU=; b=kyTMZVbXPPxyEd7Ry79NHNc6W/SNYd2wo52v+uaKx4XJEj6uKsM+oAnrwz+S142uEP 5szQgIx/8ITBMvL5vffyaJkNhDAZQD4RQt9k78waVxNP/sOm00mw3m3NRt4qzQPGC6zU wumherBOl9sjdAlxvZ6CitCMOV5Z46vJYi59klvngnRbMe15Yl8P/holfsWvAIlWTqt4 OeR90GvqB75XkJ3Yhe9S99Te7FIE0BQzFW8otb76rYGOKNctF5sOuHvsAeUnAYLuwaiN mKW06eeTBIu5hx0UYdypfNhjPD3DrtokoUim+f8sklaUEiOfGBXmWUJ+F6cfrzl46q+i TgvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=ZTvm9dawsrAvg/0kp+KzEWsiNH8QxHZk2ZLtJWCc5UU=; b=HvEzc1hKZ8ZLNCxW+s191EeZIhHhbo8nHMCGPJkL/O5jAPRN1WMzBMmko6aO7pKNeo PHxlr7WIZsdsuiImk3idbNyweTtdaafn0zpV/XdTs0PEsAbxZ5U9JI0v3aVmxiDgGzBR VJyu4iBLdH9sd8AqeKOUCJMLXiw9vdGyHV4Lk7LPyRO2vIj82QoIIU3lzeOiFJpGSaER iqLtv3jFHU91g3BaQ6jo0eWKviwTu9qb1wUrzTVETsCeXfc0mtTi+JGpVz6WwAd/yliK 0IZkDBkuy2gnfWU9AWOGxrsfL5WWGSM4Xvfo/kojhsEYQEL/USmTkE+VVH9wGMbfP0Eq LN5w== X-Gm-Message-State: AIVw112OUGxJ5dDU+60VdAEAJxSkWlKtCK9xBL6/DRfZ6hmf7taE9iC+ Xd7jC3LXdBncky5GVr4= X-Received: by 10.99.2.148 with SMTP id 142mr1149568pgc.164.1501824521365; Thu, 03 Aug 2017 22:28:41 -0700 (PDT) Received: from bigtime.twiddle.net (97-126-108-236.tukw.qwest.net. [97.126.108.236]) by smtp.gmail.com with ESMTPSA id m5sm1053099pfg.22.2017.08.03.22.28.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 Aug 2017 22:28:40 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 3 Aug 2017 22:28:27 -0700 Message-Id: <20170804052833.10187-6-rth@twiddle.net> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170804052833.10187-1-rth@twiddle.net> References: <20170804052833.10187-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::243 Subject: [Qemu-devel] [PULL for-2.10 3/3] tcg: Increase minimum alignment from tcg_malloc to 8 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: borntraeger@de.ibm.com, cohuck@redhat.com, agraf@suse.de Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP For a 64-bit ILP32 host, aligning to sizeof(long) is not enough. Guess the minimum for any host is 8, as that covers uint64_t. Qemu doesn't use a host long double or host vectors, except in extremely limited circumstances. Fixes a bus error for a sparc v8plus host. Signed-off-by: Richard Henderson --- tcg/tcg.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tcg/tcg.h b/tcg/tcg.h index da78721a0d..17b7750ee6 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -762,7 +762,10 @@ static inline void *tcg_malloc(int size) { TCGContext *s = &tcg_ctx; uint8_t *ptr, *ptr_end; - size = (size + sizeof(long) - 1) & ~(sizeof(long) - 1); + + /* ??? This is a weak placeholder for minimum malloc alignment. */ + size = QEMU_ALIGN_UP(size, 8); + ptr = s->pool_cur; ptr_end = ptr + size; if (unlikely(ptr_end > s->pool_end)) {