From patchwork Thu Jun 28 02:55:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stewart Smith X-Patchwork-Id: 935866 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 41GPZW07mDz9ry1 for ; Thu, 28 Jun 2018 12:57:07 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 41GPZV5sF5zF1LQ for ; Thu, 28 Jun 2018 12:57:06 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=linux.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=stewart@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 41GPXl3WMFzF1JL for ; Thu, 28 Jun 2018 12:55:35 +1000 (AEST) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w5S2ruJQ093591 for ; Wed, 27 Jun 2018 22:55:33 -0400 Received: from e36.co.us.ibm.com (e36.co.us.ibm.com [32.97.110.154]) by mx0a-001b2d01.pphosted.com with ESMTP id 2jvndhkukk-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 27 Jun 2018 22:55:32 -0400 Received: from localhost by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 27 Jun 2018 20:55:32 -0600 Received: from b03cxnp08027.gho.boulder.ibm.com (9.17.130.19) by e36.co.us.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 27 Jun 2018 20:55:31 -0600 Received: from b03ledav003.gho.boulder.ibm.com (b03ledav003.gho.boulder.ibm.com [9.17.130.234]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w5S2tUmN8389040 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 27 Jun 2018 19:55:30 -0700 Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5EF846A047; Wed, 27 Jun 2018 20:55:30 -0600 (MDT) Received: from b03ledav003.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 946996A04F; Wed, 27 Jun 2018 20:55:29 -0600 (MDT) Received: from birb.localdomain (unknown [9.102.42.25]) by b03ledav003.gho.boulder.ibm.com (Postfix) with SMTP; Wed, 27 Jun 2018 20:55:29 -0600 (MDT) Received: by birb.localdomain (Postfix, from userid 1000) id A729C4EC6A5; Thu, 28 Jun 2018 12:55:21 +1000 (AEST) From: Stewart Smith To: Nicholas Piggin , Stewart Smith Date: Thu, 28 Jun 2018 12:55:00 +1000 X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180628025501.20676-1-stewart@linux.ibm.com> References: <20180418135513.64817b17@roar.ozlabs.ibm.com> <20180628025501.20676-1-stewart@linux.ibm.com> In-Reply-To: <20180418135513.64817b17@roar.ozlabs.ibm.com> References: <20180418135513.64817b17@roar.ozlabs.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18062802-0020-0000-0000-00000E369FF1 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00009267; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000266; SDB=6.01053344; UDB=6.00540074; IPR=6.00831268; MB=3.00021894; MTD=3.00000008; XFM=3.00000015; UTC=2018-06-28 02:55:32 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18062802-0021-0000-0000-000062173E0F Message-Id: <20180628025501.20676-6-stewart@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-06-27_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=963 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1806280029 Subject: [Skiboot] [RFC v2 PATCH 5/6] mem_check(): Correct alignment assumptions X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: skiboot@lists.ozlabs.org MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Back in the dim dark past, mem_check() was written to take the assumption that mem regions need to be sizeof(alloc_hdr) aligned. I can't see any real reason for this, so change it to sizeof(long) aligned as we count space by number of longs, so at least that kind of makes sense. We hit this assert in a future patch when preserving BOOTKERNEL across fast reboots. Signed-off-by: Stewart Smith --- core/mem_region.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/mem_region.c b/core/mem_region.c index 571ee52c929c..ce1280b64073 100644 --- a/core/mem_region.c +++ b/core/mem_region.c @@ -548,12 +548,12 @@ bool mem_check(const struct mem_region *region) struct free_hdr *f; /* Check it's sanely aligned. */ - if (region->start % sizeof(struct alloc_hdr)) { + if (region->start % sizeof(long)) { prerror("Region '%s' not sanely aligned (%llx)\n", region->name, (unsigned long long)region->start); return false; } - if ((long)region->len % sizeof(struct alloc_hdr)) { + if ((long)region->len % sizeof(long)) { prerror("Region '%s' not sane length (%llu)\n", region->name, (unsigned long long)region->len); return false;