From patchwork Thu Aug 3 18:12:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 9879611 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 4BAD060360 for ; Thu, 3 Aug 2017 18:16:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3AB8328068 for ; Thu, 3 Aug 2017 18:16:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2FCF8288DE; Thu, 3 Aug 2017 18:16:43 +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 ABF0228068 for ; Thu, 3 Aug 2017 18:16:42 +0000 (UTC) Received: from localhost ([::1]:38663 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddKfp-00014s-KH for patchwork-qemu-devel@patchwork.kernel.org; Thu, 03 Aug 2017 14:16:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ddKbn-0006OS-0D for qemu-devel@nongnu.org; Thu, 03 Aug 2017 14:12:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ddKbm-0003Dl-73 for qemu-devel@nongnu.org; Thu, 03 Aug 2017 14:12:31 -0400 Received: from mail-pf0-x243.google.com ([2607:f8b0:400e:c00::243]:37812) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ddKbm-0003D8-1S for qemu-devel@nongnu.org; Thu, 03 Aug 2017 14:12:30 -0400 Received: by mail-pf0-x243.google.com with SMTP id p13so2180241pfd.4 for ; Thu, 03 Aug 2017 11:12:30 -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=NCfn9ngDTjFU0k3ft+tNQDUow9bsqHibr6d7E56lJ4kmYDtsZWNCd9mUQIbPbsrAnC r9uIYkhEj4X0F1E2hJ4afYf+Bdn+1koiNzA2ovnbUpzhEfZawgG8kWP897T4swiNoiNX CK/DHdTjeIbykRyZdp7IexIy0TxSnS1K5Bwxvv6U9KzXBMBYHdZOUOufn6GNhIKUFuh3 BCdC3xSE+rm4gi3Bm551iVUL237PcghIMFdTKmRRmj27nHzVM+202vsiY+tfpWQCg+KM 41MwQ9gcgh0DJE2/A8uGX6dMdpin9JaPSwe1wNEJ/zjniIMoIY6XT9AlV4+R1pJ9j2TQ 2wgQ== 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=oZNBHd2qFiRYQqdnwTWx4oiiSA8PUH1A6oFYF7mOOxH12e54Wp2f2DPaWwQHpipt1C nO14i2tmVkfG5LOaX+IaMyCNhnBe5a28o6j8vud4jwZiUxSzkk+mxvSOSy5rFxmq1C38 tHOEsRs4Gr/lCEfjQ6AJQ4eS3Gt0AIqq/xIcnRknzXtFOKXv+bdryFIIWJW1HGhnwJ5J Or8T5cAa4DgIwXdUmdMzwWXJqv9EnR/cePdddI9McquWnkR/mxbEZqwI4IcJ6sgOTK8t de0ScQnEtDOA/FEGfQzkcvVRX8AYP0gPrMyL3a+UGMpFsQdEymkcu6VnHDGeJgbh0YY5 VSYg== X-Gm-Message-State: AIVw1129R6vLzWFjUbkmWMMqiEw/MQOvD/fN/vpvE2TTxwINPIRO2TtE OY2Oeij40QN+v4aZhEI= X-Received: by 10.98.106.6 with SMTP id f6mr2507201pfc.53.1501783948966; Thu, 03 Aug 2017 11:12:28 -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 133sm16410964pge.29.2017.08.03.11.12.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 Aug 2017 11:12:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Thu, 3 Aug 2017 11:12:24 -0700 Message-Id: <20170803181224.21748-4-rth@twiddle.net> X-Mailer: git-send-email 2.13.3 In-Reply-To: <20170803181224.21748-1-rth@twiddle.net> References: <20170803181224.21748-1-rth@twiddle.net> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c00::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: peter.maydell@linaro.org 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)) {