From nobody Tue Apr 23 18:54:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617884229; cv=none; d=zohomail.com; s=zohoarc; b=mBy238oykXkxPVN7n/6suLixYJ6hklhViy9RueC3/6I5+XB/JYK8Ym4KhkGj8cUVKcwQVfloSo3zFCpakTkk9AgLlsb/NUwaWv61Ajh04+EJkOF4mEPCNS6ocWygB8PKEYpyqTA7ruHgauNe0OpEoOPZb6XG0ImU/a7pdBwe8sU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617884229; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=eDvHAwIF6mX0AlxLLrgGKEgwtN3OOz7sw/+4M1PC1Ao=; b=TqW6l2vlp0c3DUQS+zcQTuRcYuQfNzvI+UXbCWbC8SSEvUw5aDnQNdCHZrrvQHIhqhAG7PJ/MxB50E7eLd18DA/z5vk43YSN4gmFmI4mgW/f6CLXSqd2e8DYGNGiUoMYEkAKY3vXCzOuFl7DeY+Dp2oWJiG9qXzcKZebVYDEXjE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617884229306735.9248110915617; Thu, 8 Apr 2021 05:17:09 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.107229.204965 (Exim 4.92) (envelope-from ) id 1lUTab-0003My-W3; Thu, 08 Apr 2021 12:16:49 +0000 Received: by outflank-mailman (output) from mailman id 107229.204965; Thu, 08 Apr 2021 12:16:49 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTab-0003Mr-SN; Thu, 08 Apr 2021 12:16:49 +0000 Received: by outflank-mailman (input) for mailman id 107229; Thu, 08 Apr 2021 12:16:49 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTab-0003Mm-2R for xen-devel@lists.xenproject.org; Thu, 08 Apr 2021 12:16:49 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id d25c10aa-527d-42d8-b670-624b41a06f87; Thu, 08 Apr 2021 12:16:48 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 3BCCDB2D3; Thu, 8 Apr 2021 12:16:47 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d25c10aa-527d-42d8-b670-624b41a06f87 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617884207; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eDvHAwIF6mX0AlxLLrgGKEgwtN3OOz7sw/+4M1PC1Ao=; b=Jh10VdM3VM36k/09nhklM42jup0OlzVtOlN26h+O5CKp2dy9zekrqWlkFkZxhrAdMVXPE+ wtv8awxlYvw/qGHwnGaDtc+1jY3Q9k1hYsKGcYeLlClgLGHL/LdjhEWsDd1uInPxEiJvxf ScWViD8W3wCUgazRsQwS7IgsQ2lTt7g= Subject: [PATCH 01/11] x86/HVM: avoid effectively open-coding xzalloc_flex_struct() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: Date: Thu, 8 Apr 2021 14:16:47 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Drop hvm_irq_size(), which exists for just this purpose. There is a difference in generated code: xzalloc_bytes() forces SMP_CACHE_BYTES alignment. I think we not only don't need this here, but actually don't want it. Signed-off-by: Jan Beulich Acked-by: Andrew Cooper --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -642,7 +642,8 @@ int hvm_domain_initialise(struct domain d->arch.hvm.params =3D xzalloc_array(uint64_t, HVM_NR_PARAMS); d->arch.hvm.io_handler =3D xzalloc_array(struct hvm_io_handler, NR_IO_HANDLERS); - d->arch.hvm.irq =3D xzalloc_bytes(hvm_irq_size(nr_gsis)); + d->arch.hvm.irq =3D xzalloc_flex_struct(struct hvm_irq, + gsi_assert_count, nr_gsis); =20 rc =3D -ENOMEM; if ( !d->arch.hvm.pl_time || !d->arch.hvm.irq || --- a/xen/include/asm-x86/hvm/irq.h +++ b/xen/include/asm-x86/hvm/irq.h @@ -98,7 +98,6 @@ struct hvm_irq { #define hvm_pci_intx_link(dev, intx) \ (((dev) + (intx)) & 3) #define hvm_domain_irq(d) ((d)->arch.hvm.irq) -#define hvm_irq_size(cnt) offsetof(struct hvm_irq, gsi_assert_count[cnt]) =20 #define hvm_isa_irq_to_gsi(isa_irq) ((isa_irq) ? : 2) =20 From nobody Tue Apr 23 18:54:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617884270; cv=none; d=zohomail.com; s=zohoarc; b=Q8ss3i9M0caaIiT+Jg9Xikb3l4AKMvti4U8OSXmx+2VpLY38GE8/ZI3bxwTwXDZyWKIqio3vUdnPJy0GTnYiQ5Ls5N2DoLwQYzVBMeL20MUN26dSTAXuTHVCdHDlanUmaeBnIMgHXQJ9gGM5GlXzWdbQ+IOqD3a1kFj4XyLXXuc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617884270; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=YjgoyLYt7SHX0fU/jqnJ8hiIG5x4umZdD9kaKSbikg8=; b=c16aXGhKdSL9Z+Pyo1Tpx+p0fywX0OJ4StSZp5ghkU7YAZuqpdM37CPWnc3I1kpg2D9yUGknVM/wDBZDm67J29p4xmyb8rq6jRthQeZ5gmOzV+cqqtbJeHroDCSUfbRDvFe8RzyvbmvDiysuk3yj5IoRExgdiMZ2AJfx6cPGlpQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617884270513146.189082642039; Thu, 8 Apr 2021 05:17:50 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.107234.204977 (Exim 4.92) (envelope-from ) id 1lUTbI-0003Tk-94; Thu, 08 Apr 2021 12:17:32 +0000 Received: by outflank-mailman (output) from mailman id 107234.204977; Thu, 08 Apr 2021 12:17:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTbI-0003Tc-5e; Thu, 08 Apr 2021 12:17:32 +0000 Received: by outflank-mailman (input) for mailman id 107234; Thu, 08 Apr 2021 12:17:31 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTbH-0003TX-Hf for xen-devel@lists.xenproject.org; Thu, 08 Apr 2021 12:17:31 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 456238ae-2933-4aa1-acc3-7110983556ff; Thu, 08 Apr 2021 12:17:30 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1E70AB007; Thu, 8 Apr 2021 12:17:30 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 456238ae-2933-4aa1-acc3-7110983556ff X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617884250; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YjgoyLYt7SHX0fU/jqnJ8hiIG5x4umZdD9kaKSbikg8=; b=GYTsYqOJBinstoNn4WhvIEOkGgCSezGloEwIGC1ui32JB78W4p+cc9o36UXx+Seqoty3tL 3NLFyLAT8EHVE3fdK8iPzzBcQazKeYCkd6WjwxqVc1hMkCNefnmbw5A0MKxvPkcLHp357c E1SsFGrAAdOSfgzJHogeITPGkV8mxvs= Subject: [PATCH 02/11] x86/vPMU: avoid effectively open-coding xzalloc_flex_struct() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Boris Ostrovsky References: Message-ID: Date: Thu, 8 Apr 2021 14:17:29 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" There is a difference in generated code: xzalloc_bytes() forces SMP_CACHE_BYTES alignment. I think we not only don't need this here, but actually don't want it. Signed-off-by: Jan Beulich Acked-by: Andrew Cooper --- a/xen/arch/x86/cpu/vpmu_intel.c +++ b/xen/arch/x86/cpu/vpmu_intel.c @@ -461,10 +461,10 @@ static int core2_vpmu_alloc_resource(str goto out_err; } =20 - core2_vpmu_cxt =3D xzalloc_bytes(sizeof(*core2_vpmu_cxt) + - sizeof(uint64_t) * fixed_pmc_cnt + - sizeof(struct xen_pmu_cntr_pair) * - arch_pmc_cnt); + core2_vpmu_cxt =3D xzalloc_flex_struct(struct xen_pmu_intel_ctxt, regs, + fixed_pmc_cnt + arch_pmc_cnt * + (sizeof(struct xen_pmu_cntr_pair)= / + sizeof(*core2_vpmu_cxt->regs))); p =3D xzalloc(uint64_t); if ( !core2_vpmu_cxt || !p ) goto out_err; From nobody Tue Apr 23 18:54:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617884301; cv=none; d=zohomail.com; s=zohoarc; b=ihKPU+qSfFOFgLNPOMAnqn7tq8lOfVLPQiImYEM/S5f3QNXWUbaQuhy642GnvLa8Iu3uvwuRbsPVUGVFJYlXU4sINjDyK+7MEHPeAQ28GGFrw3fxFn7bA0BwMbwA2iBjDl2t7vZ/P7mQvz4THGoAwEjnsCtVLLFLJDLz9KQhoi0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617884301; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QnmG9k8Zw1WTHYZkvL1RP6b1ZHGImCYwyft4ku4C/6U=; b=aYpX8+aT8sUjZTKJP43U5k2DonkHnTIyVHxg6Q2QVzy9CQn2fXi+nZWfnSMHoytBbiWZSCKJs1nalmL55vE6YAZkG3r2IvmsuOJ0q7hGCnt9q1cqvx8DQr0p4qyc51xYkfZBw6dO/OM1xNip4SfKsrRwPk28Et8Swv5KVqxZaDc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617884301889912.1089976456647; Thu, 8 Apr 2021 05:18:21 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.107237.204989 (Exim 4.92) (envelope-from ) id 1lUTbl-0003Zz-IA; Thu, 08 Apr 2021 12:18:01 +0000 Received: by outflank-mailman (output) from mailman id 107237.204989; Thu, 08 Apr 2021 12:18:01 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTbl-0003Zs-EL; Thu, 08 Apr 2021 12:18:01 +0000 Received: by outflank-mailman (input) for mailman id 107237; Thu, 08 Apr 2021 12:17:59 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTbj-0003ZO-T4 for xen-devel@lists.xenproject.org; Thu, 08 Apr 2021 12:17:59 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 90761739-f7d3-4dd4-80d1-076cba7ebca2; Thu, 08 Apr 2021 12:17:59 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 4EF1FB090; Thu, 8 Apr 2021 12:17:58 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 90761739-f7d3-4dd4-80d1-076cba7ebca2 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617884278; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QnmG9k8Zw1WTHYZkvL1RP6b1ZHGImCYwyft4ku4C/6U=; b=jARlKgxxgKd+LvB/iXqHR4JKLtrBD7/3V9FIdXlHV+vniPp/MLLCibRxuHF+WQxNFcZbdp SzojpNL3PZBmLmiHV7drDOaPWnEAJXsTNHahdvT7+/kC2vPdpEym1XinF+WcujsqSjmbSl 5s1M7h/eHRv274C0zjtxNc5RT3sLpM8= Subject: [PATCH 03/11] x86/MCE: avoid effectively open-coding xmalloc_array() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: <47101cea-a856-3921-dd19-89ce766aaaeb@suse.com> Date: Thu, 8 Apr 2021 14:17:58 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" There is a difference in generated code: xmalloc_bytes() forces SMP_CACHE_BYTES alignment. I think we not only don't need this here, but actually don't want it. Signed-off-by: Jan Beulich --- a/xen/arch/x86/cpu/mcheck/mctelem.c +++ b/xen/arch/x86/cpu/mcheck/mctelem.c @@ -345,7 +345,7 @@ void __init mctelem_init(unsigned int da =20 if ((mctctl.mctc_elems =3D xmalloc_array(struct mctelem_ent, MC_NENT)) =3D=3D NULL || - (datarr =3D xmalloc_bytes(MC_NENT * datasz)) =3D=3D NULL) { + (datarr =3D xmalloc_array(char, MC_NENT * datasz)) =3D=3D NULL) { xfree(mctctl.mctc_elems); printk("Allocations for MCA telemetry failed\n"); return; From nobody Tue Apr 23 18:54:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617884332; cv=none; d=zohomail.com; s=zohoarc; b=Mv/T+ZW/f6k7cPEASFKRhCCzVYO7bXlB9A+wjHPOHqLPikIGbUTo/RoH7lJ2qP8MuVbqwsLMTFWOXEfIart8c8Hp7V1TxMm4aVEQpnjURFlMchOibmOXu0Hq77cb7SkBa/nFvnQi4yc0USmTEAPINaiSolApsvcPx6+qo0y9Log= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617884332; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rkX7CzUIHm8zyEM9IisY4rl2NOQycbZjijQaZgGhueY=; b=HgR3UNaraC55zcYNYPZJJ/LTL1aRcqIPlzUmoPzfcvQeOscmUvGg0t+rM2+KK7w9ze2lOvNCwyA5ZV/OMhHV9U7smVktS4e+F/wl5391gGcaPH8P7yz9Se0P5KG9WvunNhknhqy6ajv3+qvZLCdQgmZgtFTOomuVMyZStMm0Sq4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617884332134954.432173394332; Thu, 8 Apr 2021 05:18:52 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.107241.205001 (Exim 4.92) (envelope-from ) id 1lUTcF-0003g8-Q9; Thu, 08 Apr 2021 12:18:31 +0000 Received: by outflank-mailman (output) from mailman id 107241.205001; Thu, 08 Apr 2021 12:18:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTcF-0003g1-My; Thu, 08 Apr 2021 12:18:31 +0000 Received: by outflank-mailman (input) for mailman id 107241; Thu, 08 Apr 2021 12:18:30 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTcE-0003fC-Jo for xen-devel@lists.xenproject.org; Thu, 08 Apr 2021 12:18:30 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 671d1e7e-cda6-48b3-b1d9-f225f71af49d; Thu, 08 Apr 2021 12:18:27 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 30EAFAFCC; Thu, 8 Apr 2021 12:18:26 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 671d1e7e-cda6-48b3-b1d9-f225f71af49d X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617884306; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rkX7CzUIHm8zyEM9IisY4rl2NOQycbZjijQaZgGhueY=; b=A3qqKzk4yj5DecWdzpWMWiGjXBkAHG2eQY9GoPQ8YZEw6TRe+qSR08w6Ug3tvkEQhsbE4x EzYLTROyPEv05yU8bKXTtkYiNrgU6+O1Ewny+iB4p8Xk8T9DHCE/WRpowrMHklYsWYGhei +tCHFYTufSnVc/TH+AzQnazB0tjlNYY= Subject: [PATCH 04/11] x86/HVM: avoid effectively open-coding xmalloc_array() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Paul Durrant References: Message-ID: Date: Thu, 8 Apr 2021 14:18:25 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" There is a difference in generated code: xmalloc_bytes() forces SMP_CACHE_BYTES alignment. I think we not only don't need this here, but actually don't want it. Signed-off-by: Jan Beulich --- a/xen/arch/x86/hvm/emulate.c +++ b/xen/arch/x86/hvm/emulate.c @@ -1924,7 +1924,7 @@ static int hvmemul_rep_movs( dgpa -=3D bytes - bytes_per_rep; =20 /* Allocate temporary buffer. Fall back to slow emulation if this fail= s. */ - buf =3D xmalloc_bytes(bytes); + buf =3D xmalloc_array(char, bytes); if ( buf =3D=3D NULL ) return X86EMUL_UNHANDLEABLE; =20 @@ -2037,7 +2037,7 @@ static int hvmemul_rep_stos( for ( ; ; ) { bytes =3D *reps * bytes_per_rep; - buf =3D xmalloc_bytes(bytes); + buf =3D xmalloc_array(char, bytes); if ( buf || *reps <=3D 1 ) break; *reps >>=3D 1; From nobody Tue Apr 23 18:54:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617884400; cv=none; d=zohomail.com; s=zohoarc; b=eV2B64np1bjroWTc6LJfssOpLOeC0rqaDmxLNkRmaZMQXc4tUvwgAlgooU4AoG+gje7gBalGlF466+DrH74kChtHSTx3MxsOwuZOeXwA6IVVxO2uauz2B38lP8Ciu6X5/yv+l95gnFp7bwZ/Z+SdsxEpXgMQh83sPiLoG4RfFas= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617884400; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=CDQ3ZAFyCDWafzng7hnKKPU/+/S54DwWZulXulR1ydM=; b=m7luUK4twChNGEBF4+ER3lMUM2VdcT48l+Qp9aAcpGPrbA5g9bQ8hfMC3z/o16Di2zUEwvKes/nALz66/i7fUNSRijf1JU88dltnG2Z0FBE1lNPxHpt9z1t5q4j9rdKXxbuVaWrxKJ9j2MbJ/9zKDDzhxu80b6HF3j4SBwa9z8s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617884399973945.8197856219944; Thu, 8 Apr 2021 05:19:59 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.107245.205013 (Exim 4.92) (envelope-from ) id 1lUTd8-0003q3-6E; Thu, 08 Apr 2021 12:19:26 +0000 Received: by outflank-mailman (output) from mailman id 107245.205013; Thu, 08 Apr 2021 12:19:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTd8-0003pw-14; Thu, 08 Apr 2021 12:19:26 +0000 Received: by outflank-mailman (input) for mailman id 107245; Thu, 08 Apr 2021 12:19:24 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTd6-0003oQ-GC for xen-devel@lists.xenproject.org; Thu, 08 Apr 2021 12:19:24 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id c266e007-5997-4fca-af7d-9cfc84cc26d0; Thu, 08 Apr 2021 12:19:23 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id CBFC6B005; Thu, 8 Apr 2021 12:19:22 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c266e007-5997-4fca-af7d-9cfc84cc26d0 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617884362; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CDQ3ZAFyCDWafzng7hnKKPU/+/S54DwWZulXulR1ydM=; b=vQsXBPZTT3RHR7jNPNRXX/InSms8SVvQnJDnyqhayLkd4PSiomA1yr/n7vqHKih8rdyZkr jjM6gr3zpnxkD1MbvUNS6ZxqZNtHS0Zo0pckqiUvK3BddXL7EqfQEChgSe2k+pIbZWD+jr BPsztQ/SoIJW1femb3OISs04rfV9UHg= Subject: [PATCH 05/11] x86/oprofile: avoid effectively open-coding xmalloc_array() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: <029d1c22-332a-a1bf-489b-fdee70d8974e@suse.com> Date: Thu, 8 Apr 2021 14:19:22 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" There is a difference in generated code: xmalloc_bytes() forces SMP_CACHE_BYTES alignment. I think we not only don't need this here, but actually don't want it. While at it also use XFREE() instead of open-coding it and change loop induction variable types. Signed-off-by: Jan Beulich --- a/xen/arch/x86/oprofile/nmi_int.c +++ b/xen/arch/x86/oprofile/nmi_int.c @@ -142,30 +142,29 @@ static void nmi_save_registers(void * du =20 static void free_msrs(void) { - int i; + unsigned int i; + for (i =3D 0; i < nr_cpu_ids; ++i) { - xfree(cpu_msrs[i].counters); - cpu_msrs[i].counters =3D NULL; - xfree(cpu_msrs[i].controls); - cpu_msrs[i].controls =3D NULL; + XFREE(cpu_msrs[i].counters); + XFREE(cpu_msrs[i].controls); } } =20 =20 static int allocate_msrs(void) { + unsigned int i; int success =3D 1; - size_t controls_size =3D sizeof(struct op_msr) * model->num_controls; - size_t counters_size =3D sizeof(struct op_msr) * model->num_counters; =20 - int i; for_each_online_cpu (i) { - cpu_msrs[i].counters =3D xmalloc_bytes(counters_size); + cpu_msrs[i].counters =3D xmalloc_array(struct op_msr, + model->num_counters); if (!cpu_msrs[i].counters) { success =3D 0; break; } - cpu_msrs[i].controls =3D xmalloc_bytes(controls_size); + cpu_msrs[i].controls =3D xmalloc_array(struct op_msr, + model->num_controls); if (!cpu_msrs[i].controls) { success =3D 0; break; From nobody Tue Apr 23 18:54:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617884443; cv=none; d=zohomail.com; s=zohoarc; b=OPvontP0nukFI2ejP+A/nXTEpVPzf4DPueLs05OtONy0On8PJlQq+XQHbnYBxgFFf/I24l7rk4NL7komCxv7goWDsYyxD7gfR+Tc4aM/6u2StOwhBEKajeqN5IdknX8rkHznC4XjYLaqjI5DmB1+KmpYQenZx4cVu1rFwxxjJhE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617884443; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=dQLFBbZwmFP7/XJISrFVWgSoZI+0nr2VJyf5BHmRMeA=; b=SM26c184bg8sEe6Ga9o5MwmgDbA2HCnnoIoFLLIuUb5FV31g0grBVoXq4uvsp26MYND1nV9bMxz9s1dL0Eegk5iDCgOAdGV52p17EBIUEHDv4XH7jFlsWCuSN/9rWP00A/Wf2tmA4/n/WmdDwTTu+6WHsPL62Cfvt2FMl1L9Tgs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617884443085273.1724669907677; Thu, 8 Apr 2021 05:20:43 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.107252.205037 (Exim 4.92) (envelope-from ) id 1lUTe8-0004hh-TW; Thu, 08 Apr 2021 12:20:28 +0000 Received: by outflank-mailman (output) from mailman id 107252.205037; Thu, 08 Apr 2021 12:20:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTe8-0004ha-QT; Thu, 08 Apr 2021 12:20:28 +0000 Received: by outflank-mailman (input) for mailman id 107252; Thu, 08 Apr 2021 12:20:28 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTe7-0004hC-Td for xen-devel@lists.xenproject.org; Thu, 08 Apr 2021 12:20:27 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 1d3974a3-264d-4372-88fd-dc6326da25d9; Thu, 08 Apr 2021 12:20:27 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 4B643B0E6; Thu, 8 Apr 2021 12:20:26 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 1d3974a3-264d-4372-88fd-dc6326da25d9 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617884426; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dQLFBbZwmFP7/XJISrFVWgSoZI+0nr2VJyf5BHmRMeA=; b=RQDKsL8zp4IN2ANmpnNqpG1LhduC6Z/nnT4q7+7JgHelBGhZIr6M0yByjuuC8Ph7W8mJ9V oPV3r7z7s+N1Q0dkGgzcX2sB1ANp69zW0VJJJ4Nr961S+nvIq2jY5IKHJhAjJO6+tw+Knh t3+gkgweDp2Qwj4X+28vF2CmHkiiiXo= Subject: [PATCH 06/11] x86/IRQ: avoid over-alignment in alloc_pirq_struct() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: <75885e8f-fd0a-5ac1-b194-7f8858320874@suse.com> Date: Thu, 8 Apr 2021 14:20:26 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" In particular in the PV case xzalloc_bytes() forcing SMP_CACHE_BYTES alignment is counterproductive, as the allocation size there is only 40 bytes. Signed-off-by: Jan Beulich --- a/xen/arch/x86/irq.c +++ b/xen/arch/x86/irq.c @@ -1313,9 +1313,12 @@ void cleanup_domain_irq_mapping(struct d =20 struct pirq *alloc_pirq_struct(struct domain *d) { - size_t sz =3D is_hvm_domain(d) ? sizeof(struct pirq) : - offsetof(struct pirq, arch.hvm); - struct pirq *pirq =3D xzalloc_bytes(sz); + union pirq_pv { + char space[offsetof(struct pirq, arch.hvm)]; + void *align; + }; + struct pirq *pirq =3D is_hvm_domain(d) ? xzalloc(struct pirq) + : (void *)xzalloc(union pirq_pv); =20 if ( pirq ) { From nobody Tue Apr 23 18:54:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617884473; cv=none; d=zohomail.com; s=zohoarc; b=AGQx20ZeNXVVI9KTF6d6CIG1vhwFxC9nxb1duR5uSFoyPM48rA363JdR22HyvBUJIKTEk2SNr5AQEhWb9RN81DSo2KBk0ySiRTmb8zgQgQgZ5m76YXr4S2fdlfXODSq+2S3wA5M6t8YoOM/s3LwDsagqNQ4YBm8xwYdFoYnMj20= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617884473; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=rlkZ2gHfa7wMnDFvJ4VBlthgmsqLlVSVbOIY+whHTZo=; b=OyVXWpmAqQQTVlrS/mHpGVuH8wyBJ87vbfbtWshk1tUDBPhrvbiSVItVpB1P1tAkZzVU2PmyrsDur2p6sUcSoneipw/BHrtN5EZ5nsIgiHRgYddMdifZ9OTT5TBhWOvVPfprV1voi8l1YPfrK9FdadHWsgJe5G88lGob/Q7mlzQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 161788447318916.540723457293325; Thu, 8 Apr 2021 05:21:13 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.107260.205048 (Exim 4.92) (envelope-from ) id 1lUTeW-0004qp-7i; Thu, 08 Apr 2021 12:20:52 +0000 Received: by outflank-mailman (output) from mailman id 107260.205048; Thu, 08 Apr 2021 12:20:52 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTeW-0004qh-48; Thu, 08 Apr 2021 12:20:52 +0000 Received: by outflank-mailman (input) for mailman id 107260; Thu, 08 Apr 2021 12:20:51 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTeU-0004qS-U4 for xen-devel@lists.xenproject.org; Thu, 08 Apr 2021 12:20:50 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id feb7a45f-91cb-4bde-abe5-e9a11b935368; Thu, 08 Apr 2021 12:20:49 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 0FB44B090; Thu, 8 Apr 2021 12:20:49 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: feb7a45f-91cb-4bde-abe5-e9a11b935368 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617884449; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rlkZ2gHfa7wMnDFvJ4VBlthgmsqLlVSVbOIY+whHTZo=; b=BhdG0F4k+a1SrcQc+iLOYzWIB53zUhsgnWZVWNX85ywHaGPxfHby4HFyTmGSZpBKQ1XyqN emDXLzzH6vmysdgphmEjjAw5j9I0pNzB9bvXbCiZxjsvjFHXxbu2SPdJNZ0Mz/XkqmzTVP UEJA/T9/sDpwxrb0Ob/A1aB0oR9t4n4= Subject: [PATCH 07/11] EFI/runtime: avoid effectively open-coding xmalloc_array() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: <154a423e-ede1-b799-c616-a0022b815606@suse.com> Date: Thu, 8 Apr 2021 14:20:48 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" There is a difference in generated code: xmalloc_bytes() forces SMP_CACHE_BYTES alignment. I think we not only don't need this here, but actually don't want it. Signed-off-by: Jan Beulich --- a/xen/common/efi/runtime.c +++ b/xen/common/efi/runtime.c @@ -486,7 +486,7 @@ int efi_runtime_call(struct xenpf_efi_ru size =3D op->u.get_variable.size; if ( size ) { - data =3D xmalloc_bytes(size); + data =3D xmalloc_array(unsigned char, size); if ( !data ) { xfree(name); @@ -536,7 +536,7 @@ int efi_runtime_call(struct xenpf_efi_ru return -EIO; } =20 - data =3D xmalloc_bytes(op->u.set_variable.size); + data =3D xmalloc_array(unsigned char, op->u.set_variable.size); if ( !data ) rc =3D -ENOMEM; else if ( copy_from_guest(data, op->u.set_variable.data, @@ -571,7 +571,7 @@ int efi_runtime_call(struct xenpf_efi_ru return -EINVAL; =20 size =3D op->u.get_next_variable_name.size; - name.raw =3D xzalloc_bytes(size); + name.raw =3D xzalloc_array(unsigned char, size); if ( !name.raw ) return -ENOMEM; if ( copy_from_guest(name.raw, op->u.get_next_variable_name.name, From nobody Tue Apr 23 18:54:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617884495; cv=none; d=zohomail.com; s=zohoarc; b=ELdheiKWMmE31fON9Z2HrBpQctLavHWXx59h92T8rGCN66u4b7oCacXaKSEoAuKaJ59KWj7vISzqNvUq1XREdsw+7dHGytJPuOxM29z4RCBX0JhpdFno/dg7so5QVRpi06/NRYSiiTJT1eqglKqicaasu8aXhrJ//QQjadMhtMU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617884495; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=95K+5XUUtlkYqbXmQ6a5fXeN2FQDprpFs5vXWIcZVZg=; b=FGKIl8hl7dBnbwCOlJORHvDvsrIan8b20wjMhoDepnppcZ3ezGT4eRJpz7kPgC95oh7K0YFhscuyH9SfffMeYnCwKJlD/yMqvnhaRxzAmKVIUW2L7Gr5VipfZw49xZo2EfOen8z/WR/MsX9y4MscX8BtRSp00vzHx51TKmzHDO0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617884495977363.9038727781393; Thu, 8 Apr 2021 05:21:35 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.107266.205061 (Exim 4.92) (envelope-from ) id 1lUTet-0004zy-HC; Thu, 08 Apr 2021 12:21:15 +0000 Received: by outflank-mailman (output) from mailman id 107266.205061; Thu, 08 Apr 2021 12:21:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTet-0004zr-DT; Thu, 08 Apr 2021 12:21:15 +0000 Received: by outflank-mailman (input) for mailman id 107266; Thu, 08 Apr 2021 12:21:15 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTes-0004zj-Vc for xen-devel@lists.xenproject.org; Thu, 08 Apr 2021 12:21:15 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 76f69303-e529-4e9f-be2a-5819f072873d; Thu, 08 Apr 2021 12:21:14 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 783CCB005; Thu, 8 Apr 2021 12:21:13 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 76f69303-e529-4e9f-be2a-5819f072873d X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617884473; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=95K+5XUUtlkYqbXmQ6a5fXeN2FQDprpFs5vXWIcZVZg=; b=S9waDlL3HqvdRuOGtWJksVXo0t/AWmRdrboRuIw4xSAqDnTOnG4ob4TDErr4RliklvWgG6 Yh8WAQ13IqaSkqp3oq9jBS/nvNHXRAkAnud4v2DXIrkCfaZibMILpLSFjF/k/Xbyk8q+wF o03tS4X5ymR8WENgliRv5EGkTKWLmho= Subject: [PATCH 08/11] hypfs: avoid effectively open-coding xzalloc_array() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Juergen Gross References: Message-ID: Date: Thu, 8 Apr 2021 14:21:13 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" There is a difference in generated code: xzalloc_bytes() forces SMP_CACHE_BYTES alignment. I think we not only don't need this here, but actually don't want it. To avoid the need to add a cast, do away with the only forward-declared struct hypfs_dyndata. Signed-off-by: Jan Beulich Reviewed-by: Juergen Gross --- a/xen/common/hypfs.c +++ b/xen/common/hypfs.c @@ -72,7 +72,7 @@ enum hypfs_lock_state { hypfs_write_locked }; static DEFINE_PER_CPU(enum hypfs_lock_state, hypfs_locked); -static DEFINE_PER_CPU(struct hypfs_dyndata *, hypfs_dyndata); +static DEFINE_PER_CPU(void *, hypfs_dyndata); =20 static DEFINE_PER_CPU(const struct hypfs_entry *, hypfs_last_node_entered); =20 @@ -160,19 +160,19 @@ static void node_exit_all(void) void *hypfs_alloc_dyndata(unsigned long size) { unsigned int cpu =3D smp_processor_id(); - struct hypfs_dyndata **dyndata =3D &per_cpu(hypfs_dyndata, cpu); + void **dyndata =3D &per_cpu(hypfs_dyndata, cpu); =20 ASSERT(per_cpu(hypfs_locked, cpu) !=3D hypfs_unlocked); ASSERT(*dyndata =3D=3D NULL); =20 - *dyndata =3D xzalloc_bytes(size); + *dyndata =3D xzalloc_array(unsigned char, size); =20 return *dyndata; } =20 void *hypfs_get_dyndata(void) { - struct hypfs_dyndata *dyndata =3D this_cpu(hypfs_dyndata); + void *dyndata =3D this_cpu(hypfs_dyndata); =20 ASSERT(dyndata); =20 @@ -181,7 +181,7 @@ void *hypfs_get_dyndata(void) =20 void hypfs_free_dyndata(void) { - struct hypfs_dyndata **dyndata =3D &this_cpu(hypfs_dyndata); + void **dyndata =3D &this_cpu(hypfs_dyndata); =20 XFREE(*dyndata); } From nobody Tue Apr 23 18:54:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617884535; cv=none; d=zohomail.com; s=zohoarc; b=jcuqgmc4CXDHvAME+IfndEQszMOCEdOANl3qNtDNrcz0pP4axuH8nHWc6rzWzWkNPnlBTdXfPEL8iXdN543tMjB0SGj0tvyw8MhZgvO9CEi8+fYRHn6uVueRlcxR+ppx3AK8cBubgzMnEPC4O8mnKwG2W+zyOShpa3qfdUbrEf0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617884535; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=LAS4slsq4qONsaHE0lyME1eabgS+LFpyRRMDvBlV5sc=; b=m0NpAWwaQH1TYNaTXr0e5Ue5E5j6BsJp27CpuTAWc/rRd6vmiXLJbGeIvdlga6rsSJ1qeQ5U/Qxnw2cpoEOZSfO77PujRg88Vfl+pcVVjMgCAEi2mLuyxEtaDkG+VDB60iFkqe3tKDgOyYwIGkkcJIKpw5+pnAPk6Yb7sWeMy2M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617884535043649.2961897043515; Thu, 8 Apr 2021 05:22:15 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.107270.205073 (Exim 4.92) (envelope-from ) id 1lUTfa-0005BI-Rz; Thu, 08 Apr 2021 12:21:58 +0000 Received: by outflank-mailman (output) from mailman id 107270.205073; Thu, 08 Apr 2021 12:21:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTfa-0005BA-Np; Thu, 08 Apr 2021 12:21:58 +0000 Received: by outflank-mailman (input) for mailman id 107270; Thu, 08 Apr 2021 12:21:58 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTfa-0005B4-0O for xen-devel@lists.xenproject.org; Thu, 08 Apr 2021 12:21:58 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 6aeaeecf-1243-49ad-a7dc-c662847675c7; Thu, 08 Apr 2021 12:21:57 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 85B6CB11B; Thu, 8 Apr 2021 12:21:56 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 6aeaeecf-1243-49ad-a7dc-c662847675c7 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617884516; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=LAS4slsq4qONsaHE0lyME1eabgS+LFpyRRMDvBlV5sc=; b=ZrFnoZpjK9Y19sBBy9uNVmzq4/dp0pOy9jaf3xnlZVefPiEcKfD2Qo9n+Gno76tar54dwW u1qS/04eB3ERc5WHo0iigppR1yQNUol2Eb85l6RKt32yLdonMupcF6BawOrle6hhSvMLZz mfGCVKdyxHYKdfTIZSRjwbs5X8uky3c= Subject: [PATCH 09/11] kexec: avoid effectively open-coding xzalloc_flex_struct() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap References: Message-ID: <4ea9c4a3-74c0-1722-fa5d-3930be99ef4a@suse.com> Date: Thu, 8 Apr 2021 14:21:56 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" There is a difference in generated code: xzalloc_bytes() forces SMP_CACHE_BYTES alignment. I think we not only don't need this here, but actually don't want it. Signed-off-by: Jan Beulich --- a/xen/common/kexec.c +++ b/xen/common/kexec.c @@ -463,7 +463,10 @@ static void * alloc_from_crash_heap(cons /* Allocate a crash note buffer for a newly onlined cpu. */ static int kexec_init_cpu_notes(const unsigned long cpu) { - Elf_Note * note =3D NULL; + struct elf_notes { + Elf_Note first; + unsigned char more[]; + } *notes =3D NULL; int ret =3D 0; int nr_bytes =3D 0; =20 @@ -477,7 +480,8 @@ static int kexec_init_cpu_notes(const un =20 /* If we dont care about the position of allocation, malloc. */ if ( low_crashinfo_mode =3D=3D LOW_CRASHINFO_NONE ) - note =3D xzalloc_bytes(nr_bytes); + notes =3D xzalloc_flex_struct(struct elf_notes, more, + nr_bytes - sizeof(notes->first)); =20 /* Protect the write into crash_notes[] with a spinlock, as this funct= ion * is on a hotplug path and a hypercall path. */ @@ -490,26 +494,28 @@ static int kexec_init_cpu_notes(const un spin_unlock(&crash_notes_lock); /* Always return ok, because whether we successfully allocated or = not, * another CPU has successfully allocated. */ - xfree(note); + xfree(notes); } else { /* If we care about memory possition, alloc from the crash heap, * also protected by the crash_notes_lock. */ if ( low_crashinfo_mode > LOW_CRASHINFO_NONE ) - note =3D alloc_from_crash_heap(nr_bytes); + notes =3D alloc_from_crash_heap(nr_bytes); =20 - crash_notes[cpu].start =3D note; + crash_notes[cpu].start =3D ¬es->first; crash_notes[cpu].size =3D nr_bytes; spin_unlock(&crash_notes_lock); =20 /* If the allocation failed, and another CPU did not beat us, give * up with ENOMEM. */ - if ( ! note ) + if ( ! notes ) ret =3D -ENOMEM; /* else all is good so lets set up the notes. */ else { + Elf_Note *note =3D ¬es->first; + /* Set up CORE note. */ setup_note(note, "CORE", NT_PRSTATUS, sizeof(ELF_Prstatus)); note =3D ELFNOTE_NEXT(note); From nobody Tue Apr 23 18:54:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617884556; cv=none; d=zohomail.com; s=zohoarc; b=DB99tfpEXDsEXYcdaGpeiIVEVQEKWQkhpNmyMIKgzdrL/ai8oz4PVlsnYqjA97zLoIqYuUvoVkWiOP9muBYxYw7qQgnn29CTGHFDP12WbiVpS4pgpSiqMLstWDN80BPcicjDw/PcbJOO2h5jwGi07giHf2XWSUMXT81JTM8TEwc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617884556; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=yw8CWbx2pQJIEiz3GQW/HJc3UcPF7hTPHrhYjaL9Afc=; b=WZKbXxi3/de9ybjkWo0PYvKArQC66PZonzIeV37RazHdnCDmQ8ehFNJ00bZib/SjW/y0ELuTv1I933V+cSgMfxGUZiX2Zj7SDkxYEHBHQzFq1eTFds4FgW/ZUEiMUQJ3+2sKHZBlJu7QN8OTVUVLGm7FYpCMk/ANYMoancdj0ME= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617884556828767.7490742498468; Thu, 8 Apr 2021 05:22:36 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.107273.205085 (Exim 4.92) (envelope-from ) id 1lUTfw-0005Hb-3w; Thu, 08 Apr 2021 12:22:20 +0000 Received: by outflank-mailman (output) from mailman id 107273.205085; Thu, 08 Apr 2021 12:22:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTfw-0005HU-08; Thu, 08 Apr 2021 12:22:20 +0000 Received: by outflank-mailman (input) for mailman id 107273; Thu, 08 Apr 2021 12:22:18 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTfu-0005HE-H6 for xen-devel@lists.xenproject.org; Thu, 08 Apr 2021 12:22:18 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id bf8f449f-9a86-476a-9037-856b12ccccfc; Thu, 08 Apr 2021 12:22:17 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2243BB005; Thu, 8 Apr 2021 12:22:17 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: bf8f449f-9a86-476a-9037-856b12ccccfc X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617884537; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yw8CWbx2pQJIEiz3GQW/HJc3UcPF7hTPHrhYjaL9Afc=; b=fbV0ORejrfI1vC5N37glstyj2ieCvn/yvOHuDv1Xs0lZN1N00myO81LBoMF/qK8VwJgWoR dgkQ3MlPeCrUPgN+hB+ca1Ffktw4CI0tZXFfHPurVvRrbKCRbgx+PCNtOAjn6026/4ZWCg BxTCN3wWIcg1YJsXoj0eO/55k9U1FjU= Subject: [PATCH 10/11] video/lfb: avoid effectively open-coding xzalloc_array() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , George Dunlap , Ian Jackson , Julien Grall , Stefano Stabellini , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: Message-ID: Date: Thu, 8 Apr 2021 14:22:16 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" There is a difference in generated code: xzalloc_bytes() forces SMP_CACHE_BYTES alignment. I think we not only don't need this here, but actually don't want it. Signed-off-by: Jan Beulich --- a/xen/drivers/video/lfb.c +++ b/xen/drivers/video/lfb.c @@ -147,8 +147,9 @@ int __init lfb_init(struct lfb_prop *lfb { lfb.lfbp =3D *lfbp; =20 - lfb.lbuf =3D xmalloc_bytes(lfb.lfbp.bytes_per_line); - lfb.text_buf =3D xzalloc_bytes(lfb.lfbp.text_columns * lfb.lfbp.text_r= ows); + lfb.lbuf =3D xmalloc_array(unsigned char, lfb.lfbp.bytes_per_line); + lfb.text_buf =3D xzalloc_array(unsigned char, + lfb.lfbp.text_columns * lfb.lfbp.text_row= s); lfb.line_len =3D xzalloc_array(unsigned int, lfb.lfbp.text_columns); =20 if ( !lfb.lbuf || !lfb.text_buf || !lfb.line_len ) From nobody Tue Apr 23 18:54:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1617884622; cv=none; d=zohomail.com; s=zohoarc; b=BDnrc515RsSTF3zQVJ0ANw1z7ipdGq7tdJP0zd0syRs9luQrITYSq0Ije1GGLlWdw+ilkdZeHtpepIclTif5Cjt8z9FkvxGU5efMVCMUOmgHVjRfWRwdiq2h7jcpYizatifwq/7ngnxR3uZNZo97pyj5LEZuNtFO9TRiyiLiBpk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617884622; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JP7NYsf4fopqSVgYCDwHxKC3KJzvwiy4UDKP6yZkCFM=; b=TBhV8qKvdmbIXZz/GS2so8Tn3lXR0zu+Xs/VKNfEjKyjZp3QJIqEh14PeNRGQ9yBldBm4FPo4n2ZSHnMXiGSXVVCovlna+qNjJnGzfuLVUQo2ZpIzjNb9/baawOoNaKNTNKtE0RXg+6hJOP8XbsjE/EncK7soP86frppxW7475U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1617884622819204.26641915422795; Thu, 8 Apr 2021 05:23:42 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.107281.205096 (Exim 4.92) (envelope-from ) id 1lUTgt-0005Qi-EX; Thu, 08 Apr 2021 12:23:19 +0000 Received: by outflank-mailman (output) from mailman id 107281.205096; Thu, 08 Apr 2021 12:23:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTgt-0005Qb-BU; Thu, 08 Apr 2021 12:23:19 +0000 Received: by outflank-mailman (input) for mailman id 107281; Thu, 08 Apr 2021 12:23:18 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lUTgs-0005QT-3c for xen-devel@lists.xenproject.org; Thu, 08 Apr 2021 12:23:18 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 66e728ea-9180-45a9-85a9-512230029e86; Thu, 08 Apr 2021 12:23:17 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 7EAB4B090; Thu, 8 Apr 2021 12:23:16 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 66e728ea-9180-45a9-85a9-512230029e86 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1617884596; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=JP7NYsf4fopqSVgYCDwHxKC3KJzvwiy4UDKP6yZkCFM=; b=laMkxHER7aSZu5M4s+gxNOdm+jcWdCLLVomCWwYt1NdHxvK6yRNallue1mMBvk3ePmgZ/s R4bV6pdtiW9iWN8d44dqOpx1L2HNAvdRV6EfXVopbCy3BUw2Qt3nprT3UEV2kf6R5cBt2x Orhi2dsrZGsJUITGPFWVzSE726abFvU= Subject: [PATCH 11/11] Arm/optee: don't open-code xzalloc_flex_struct() From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: George Dunlap , Julien Grall , Stefano Stabellini , Volodymyr Babchuk References: Message-ID: Date: Thu, 8 Apr 2021 14:23:16 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" There is a difference in generated code: xzalloc_bytes() forces SMP_CACHE_BYTES alignment. I think we not only don't need this here, but actually don't want it. Signed-off-by: Jan Beulich --- a/xen/arch/arm/tee/optee.c +++ b/xen/arch/arm/tee/optee.c @@ -529,8 +529,7 @@ static struct optee_shm_buf *allocate_op while ( unlikely(old !=3D atomic_cmpxchg(&ctx->optee_shm_buf_pages, old, new)) ); =20 - optee_shm_buf =3D xzalloc_bytes(sizeof(struct optee_shm_buf) + - pages_cnt * sizeof(struct page *)); + optee_shm_buf =3D xzalloc_flex_struct(struct optee_shm_buf, pages, pag= es_cnt); if ( !optee_shm_buf ) { err_code =3D -ENOMEM;