From nobody Sat Apr 20 09:39:27 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=oracle.com Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1542124499206178.69351434689008; Tue, 13 Nov 2018 07:54:59 -0800 (PST) Received: from [127.0.0.1] (helo=ra.coreboot.org) by mail.coreboot.org with esmtp (Exim 4.88) (envelope-from ) id 1gMb0t-0002nE-QV; Tue, 13 Nov 2018 16:54:03 +0100 Received: from userp2130.oracle.com ([156.151.31.86]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88) (envelope-from ) id 1gMb0d-0002me-Hq for seabios@seabios.org; Tue, 13 Nov 2018 16:54:01 +0100 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wADFn8ZZ132608; Tue, 13 Nov 2018 15:54:00 GMT Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2nnwg1bhg4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Nov 2018 15:54:00 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wADFrx6j008993 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Nov 2018 15:53:59 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wADFrxPD014046; Tue, 13 Nov 2018 15:53:59 GMT Received: from spark.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 13 Nov 2018 07:53:59 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=DnrlwJJbEjnQSDRAZ8T4yT6sf7Q1vpfGiICR1VlreJA=; b=SjGfC8lNZrwkvmLdBmsOInEu9liQck6rZ8PG+yutsR4IGuZ/+1Lj61SO1kqd3oz48Pk7 SxZCHQSk8jJZzFQ53PwxHUsR8xQ5rp7ogmBuSk9ygtAbXNAcXIM8bB2YhCJqoclmC6by 79VRH2LLXCUaj6nlE/23dNT2wZrTXIKAlLCzTkQVQXEoDBy8igs8ym6TlNmT28VMFQhc mJzeoDK8EAWv80eWrO9WN10aMIEPLIU1JQhvPm1oa6eTR79Zb0KB1yWLNUy5387kJECX b1taRdw3sWNpH8KqFZvkszzx2vikh6RHzRal4sz6ikTlM9m4GXgkcvWOVkwecFttfdn8 Hw== From: Liran Alon To: seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net Date: Tue, 13 Nov 2018 17:53:40 +0200 Message-Id: <20181113155341.133016-2-liran.alon@oracle.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181113155341.133016-1-liran.alon@oracle.com> References: <20181113155341.133016-1-liran.alon@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9076 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=963 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1811130144 X-Spam-Score: -5.6 (-----) Subject: [SeaBIOS] [PATCH 1/2] pvscsi: ring_desc do not have to be page aligned X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: idan.brown@oracle.com MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" In contrast to other allocations made by pvscsi_init_rings(), ring_desc is only used internally by SeaBIOS (not passed to device-controller) and there is not restriction which force it to be page aligned. Reviewed-by: Mark Kanda Signed-off-by: Liran Alon --- src/hw/pvscsi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hw/pvscsi.c b/src/hw/pvscsi.c index e0ea33cd751c..9d7d68d80964 100644 --- a/src/hw/pvscsi.c +++ b/src/hw/pvscsi.c @@ -167,7 +167,7 @@ pvscsi_init_rings(void *iobase, struct pvscsi_ring_dsc_= s **ring_dsc) { struct PVSCSICmdDescSetupRings cmd =3D {0,}; =20 - struct pvscsi_ring_dsc_s *dsc =3D memalign_high(PAGE_SIZE, sizeof(*dsc= )); + struct pvscsi_ring_dsc_s *dsc =3D malloc_high(sizeof(*dsc)); if (!dsc) { warn_noalloc(); return; --=20 2.16.1 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios From nobody Sat Apr 20 09:39:27 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) client-ip=80.81.252.135; envelope-from=seabios-bounces@seabios.org; helo=mail.coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 80.81.252.135 is neither permitted nor denied by domain of seabios.org) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=oracle.com Return-Path: Received: from mail.coreboot.org (mail.coreboot.org [80.81.252.135]) by mx.zohomail.com with SMTPS id 1542124505167641.9866940902866; Tue, 13 Nov 2018 07:55:05 -0800 (PST) Received: from [127.0.0.1] (helo=ra.coreboot.org) by mail.coreboot.org with esmtp (Exim 4.88) (envelope-from ) id 1gMb13-0002o2-Ar; Tue, 13 Nov 2018 16:54:13 +0100 Received: from userp2130.oracle.com ([156.151.31.86]) by mail.coreboot.org with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.88) (envelope-from ) id 1gMb0h-0002mi-38 for seabios@seabios.org; Tue, 13 Nov 2018 16:54:12 +0100 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wADFmxoQ132495; Tue, 13 Nov 2018 15:54:03 GMT Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2nnwg1bhgk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Nov 2018 15:54:03 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id wADFs2EC022582 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 13 Nov 2018 15:54:02 GMT Received: from abhmp0017.oracle.com (abhmp0017.oracle.com [141.146.116.23]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id wADFs2Ti011807; Tue, 13 Nov 2018 15:54:02 GMT Received: from spark.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 13 Nov 2018 07:54:01 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=pkQgIvtiMZJD0rCd5Nv5BTQUiVgdPZspbH5j6IngZVg=; b=45JZFAcTM2JsVc0d+Co40hesSyEmstHKPf0tdlVsNLjITa1kZUIQAhy0+FbluLALFKbp nMBqXWV5Ay8VzVt4R83PtG8Z8ZBgrEuCl06GUEyvez0pvZ7YugUXtO6PQjpRO9qBMPsp bml/s0vY+UdBsXePteXH7yJRYJcIq7CnGpL540HTec5o6SaJl6wcrAVGuCaalfANxeVh Z7GyEyJWUQXpqIgPZBP1gobr5tZV/BfxNxRL0jZ1IhiIcGhddGyr1fkUJTSeyY65FWft dWdfzZLQndcg/1Z4skrUt4SMUJFDxHo/LqnsAz9xcOAqvtSyCENO9In3nNYRFgdzrcXR DA== From: Liran Alon To: seabios@seabios.org, kraxel@redhat.com, kevin@koconnor.net Date: Tue, 13 Nov 2018 17:53:41 +0200 Message-Id: <20181113155341.133016-3-liran.alon@oracle.com> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20181113155341.133016-1-liran.alon@oracle.com> References: <20181113155341.133016-1-liran.alon@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9076 signatures=668683 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1811130144 X-Spam-Score: -5.6 (-----) Subject: [SeaBIOS] [PATCH 2/2] malloc: Fallback to low-zone when alloc from high-zone fails X-BeenThere: seabios@seabios.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SeaBIOS mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: idan.brown@oracle.com MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: seabios-bounces@seabios.org Sender: "SeaBIOS" X-Duff: Orig. Duff, Duff Lite, Duff Dry, Duff Dark, Raspberry Duff, Lady Duff, Red Duff, Tartar Control Duff X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" When 32-bit code needs to allocate memory which remains permanent after completion of the initialization phase, it doesn't care if it is allocated from high-zone or low-zone. Currently all these cases just attempt to allocate from high-zone as low-zone memory is scarce. However, in cases we don't have enough space left in high-zone, it makes sense to use low-zone as a fallback. This commit fixes an issue of a VM which failed to boot when configured with 16 PVSCSI disk controllers. The VM failed to boot because pvscsi_init_rings() failed to allocate ring_dsc when high-zone didn't had enough space for it. Reviewed-by: Mark Kanda Signed-off-by: Liran Alon --- src/malloc.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/malloc.h b/src/malloc.h index 960a7f8000f8..d8bf5092dce0 100644 --- a/src/malloc.h +++ b/src/malloc.h @@ -31,7 +31,10 @@ static inline void *malloc_low(u32 size) { return _malloc(&ZoneLow, size, MALLOC_MIN_ALIGN); } static inline void *malloc_high(u32 size) { - return _malloc(&ZoneHigh, size, MALLOC_MIN_ALIGN); + void *ret =3D _malloc(&ZoneHigh, size, MALLOC_MIN_ALIGN); + if (ret) + return ret; + return malloc_low(size); } static inline void *malloc_fseg(u32 size) { return _malloc(&ZoneFSeg, size, MALLOC_MIN_ALIGN); @@ -52,7 +55,10 @@ static inline void *memalign_low(u32 align, u32 size) { return _malloc(&ZoneLow, size, align); } static inline void *memalign_high(u32 align, u32 size) { - return _malloc(&ZoneHigh, size, align); + void *ret =3D _malloc(&ZoneHigh, size, align); + if (ret) + return ret; + return memalign_low(align, size); } static inline void *memalign_tmplow(u32 align, u32 size) { return _malloc(&ZoneTmpLow, size, align); --=20 2.16.1 _______________________________________________ SeaBIOS mailing list SeaBIOS@seabios.org https://mail.coreboot.org/mailman/listinfo/seabios