From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00751482CF; Mon, 11 Mar 2024 17:13:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710177210; cv=none; b=RWZUTuWZK4/s3OvmmwFPIU1cVqdJvpQViq/buVtytu33ATdrz/GTthhtS2FsRJ4GDPVWaDBfkQ+jztnhL2g3lOWZwlKw5bw+aj5E8wfpHJngufPr5kIlg3PiwB3Fl2GIjN8L0Rp9h3RxRMerRLznTSn1/IlmpRvjACwR8EUJmg4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710177210; c=relaxed/simple; bh=Lio1nhe7fciU4dYP74sWWd9SRcRxtgnQi2v2J158Cns=; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NzYRuvHC5+K+4hB29WbnYNt9AB/BZzcwToIqE4k/2beKrGccJWVBZE31lZarO9Vke0IHkrZvnFaBYTeheGVLVL+xVt550PsfyTM1vWEwvUCOYpYPYR2MWlEoA8csOxvrT7xQsWpB+AOnqRfuzape+VmRnzWIozY6tqyJqPBsz2E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=DzbyFf+3; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="DzbyFf+3" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42B843Tq021082; Mon, 11 Mar 2024 17:13:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=qcppdkim1; bh=7DHzIRWgki5+Z2bMSQr1Z /xOHasR45VMniFM9OQZ32g=; b=DzbyFf+3sade/LZ+DwPXYUP3Wy+6HbL5wzLsa W7SWXeCh0pGkls1m1g5FcoSbg6hJV/4T5D5vzgvdEz8eURmk2K5SmlA+ljbeJQ68 lJ6IdxSktqhOngmZTjIJbt9FafBMcHMenJY88ETrlwuxS7NhfQSFn4cz0KvPgMkU 2EjBrNiQinZpTk9jAimyNNbbbcHG/dCZeOfaYGFwaw2/5BQub8Hr4ZSNAFMzGqri 3aVbK9OwofFhoQ1qg4TEbOtdIaiSW7CJpq3EKtDIY5xT+c2+JfLkiRKq0DK4TPe/ BYlPR91IHrbZquAJhetDkvZsg2kFrOoT1u6zfL0edqWOFfIrA== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wsx48shaw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Mar 2024 17:13:05 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 42BHD4Xt021914 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Mar 2024 17:13:04 GMT Received: from hu-eberman-lv.qualcomm.com (10.49.16.6) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Mon, 11 Mar 2024 10:13:03 -0700 Date: Mon, 11 Mar 2024 10:13:03 -0700 From: Elliot Berman To: Srivatsa Vaddagiri CC: Alex Elder , Srinivas Kandagatla , Murali Nalajal , Trilok Soni , Carl van Schaik , Philip Derrin , Prakruthi Deepak Heragu , Jonathan Corbet , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Catalin Marinas , Will Deacon , Konrad Dybcio , Bjorn Andersson , Dmitry Baryshkov , "Fuad Tabba" , Sean Christopherson , "Andrew Morton" , , , , , , Subject: Re: Re: [PATCH v17 12/35] virt: gunyah: Add resource tickets Message-ID: <20240311100247856-0700.eberman@hu-eberman-lv.qualcomm.com> Mail-Followup-To: Srivatsa Vaddagiri , Alex Elder , Srinivas Kandagatla , Murali Nalajal , Trilok Soni , Carl van Schaik , Philip Derrin , Prakruthi Deepak Heragu , Jonathan Corbet , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Catalin Marinas , Will Deacon , Konrad Dybcio , Bjorn Andersson , Dmitry Baryshkov , Fuad Tabba , Sean Christopherson , Andrew Morton , linux-arm-msm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org References: <20240222-gunyah-v17-0-1e9da6763d38@quicinc.com> <20240222-gunyah-v17-12-1e9da6763d38@quicinc.com> <20240311053806.GL440762@quicinc.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20240311053806.GL440762@quicinc.com> X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 11wI3OtaIF1Dwa5d3RYzieDVyHwG5GVf X-Proofpoint-ORIG-GUID: 11wI3OtaIF1Dwa5d3RYzieDVyHwG5GVf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-11_10,2024-03-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 mlxlogscore=999 spamscore=0 impostorscore=0 adultscore=0 phishscore=0 bulkscore=0 lowpriorityscore=0 suspectscore=0 priorityscore=1501 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2403110131 On Mon, Mar 11, 2024 at 11:08:06AM +0530, Srivatsa Vaddagiri wrote: > * Elliot Berman [2024-02-22 15:16:35]: > > > Gunyah doesn't process the label and that makes it > > possible for userspace to create multiple resources with the same label. > > I think that description conflicts with what is implemented in this patch? > > int gunyah_vm_add_resource_ticket(struct gunyah_vm *ghvm, > struct gunyah_vm_resource_ticket *ticket) > { > mutex_lock(&ghvm->resources_lock); > list_for_each_entry(iter, &ghvm->resource_tickets, vm_list) { > if (iter->resource_type == ticket->resource_type && > iter->label == ticket->label) { > ret = -EEXIST; > goto out; > } > } > > > // > It's a justification for the next sentence in the commit text: Resource ticket owners need to be prepared for populate to be called multiple times if userspace created multiple resources with the same label. VM manager can make sure that only one entity is going to receive the resources (the check above you highlighted), but I can't make sure that it's only going to exactly one resource. We don't currently have a scenario where we need/want multiple resources with the same label, we might have that in the future and I didn't want to add that restriction in common code. > > @@ -134,6 +246,25 @@ static int gunyah_vm_start(struct gunyah_vm *ghvm) > > } > > ghvm->vm_status = GUNYAH_RM_VM_STATUS_READY; > > > > + ret = gunyah_rm_get_hyp_resources(ghvm->rm, ghvm->vmid, &resources); > > + if (ret) { > > + dev_warn(ghvm->parent, > > + "Failed to get hypervisor resources for VM: %d\n", > > + ret); > > + goto err; > > + } > > Where do we free memory pointed by 'resources' ptr? > Ah, I meant to add the __free(kfree) annotation. I've added it. > > + > > + for (i = 0, n = le32_to_cpu(resources->n_entries); i < n; i++) { > > + ghrsc = gunyah_rm_alloc_resource(ghvm->rm, > > + &resources->entries[i]); > > + if (!ghrsc) { > > + ret = -ENOMEM; > > + goto err; > > + } > > + > > + gunyah_vm_add_resource(ghvm, ghrsc); > > + } From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33890C5475B for ; Mon, 11 Mar 2024 17:13:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mS+DDsT2AXrcqyRsSzZwdHPvf9JpW4KY1rDKinhCsok=; b=Ex18TNlMf6eHwr 79ncjk49/JLedJcp8OsubdhbgTd3r6w0Q9palNPW/Q1afCJeZcI5Xl09pPqmwUOcY+bPF0GDlor8J 18qbMsBdoj4ZyEdXGiiXTRu3Jh6lfPJgaeEVaM0J2T3a1RWZPEi5+6ik4qZNTMevxp2oHA2dqp9Ip gBR/PORtS94NTUSUqSdOttq/9mIl9uuMVKq+ZohsIc0tnMM0U0cGBDtk3N20+7UCZvj1ea7VhiWqw MWQJ/NCLAnpgeeVtFgK8q//Z2oVUroLT1LHO1gyPPpUwlc7J9Gm7fRkLW2D8hde4ZtrWQ6j7HbENT a4lkjPfU2Gw6SNOMzLMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rjjDJ-00000002TK5-1Lc6; Mon, 11 Mar 2024 17:13:25 +0000 Received: from mx0b-0031df01.pphosted.com ([205.220.180.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rjjDG-00000002TIk-3MSz for linux-arm-kernel@lists.infradead.org; Mon, 11 Mar 2024 17:13:24 +0000 Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 42B843Tq021082; Mon, 11 Mar 2024 17:13:06 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=qcppdkim1; bh=7DHzIRWgki5+Z2bMSQr1Z /xOHasR45VMniFM9OQZ32g=; b=DzbyFf+3sade/LZ+DwPXYUP3Wy+6HbL5wzLsa W7SWXeCh0pGkls1m1g5FcoSbg6hJV/4T5D5vzgvdEz8eURmk2K5SmlA+ljbeJQ68 lJ6IdxSktqhOngmZTjIJbt9FafBMcHMenJY88ETrlwuxS7NhfQSFn4cz0KvPgMkU 2EjBrNiQinZpTk9jAimyNNbbbcHG/dCZeOfaYGFwaw2/5BQub8Hr4ZSNAFMzGqri 3aVbK9OwofFhoQ1qg4TEbOtdIaiSW7CJpq3EKtDIY5xT+c2+JfLkiRKq0DK4TPe/ BYlPR91IHrbZquAJhetDkvZsg2kFrOoT1u6zfL0edqWOFfIrA== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3wsx48shaw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Mar 2024 17:13:05 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 42BHD4Xt021914 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 11 Mar 2024 17:13:04 GMT Received: from hu-eberman-lv.qualcomm.com (10.49.16.6) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Mon, 11 Mar 2024 10:13:03 -0700 Date: Mon, 11 Mar 2024 10:13:03 -0700 From: Elliot Berman To: Srivatsa Vaddagiri CC: Alex Elder , Srinivas Kandagatla , Murali Nalajal , Trilok Soni , Carl van Schaik , Philip Derrin , Prakruthi Deepak Heragu , Jonathan Corbet , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Catalin Marinas , Will Deacon , Konrad Dybcio , Bjorn Andersson , Dmitry Baryshkov , "Fuad Tabba" , Sean Christopherson , "Andrew Morton" , , , , , , Subject: Re: Re: [PATCH v17 12/35] virt: gunyah: Add resource tickets Message-ID: <20240311100247856-0700.eberman@hu-eberman-lv.qualcomm.com> Mail-Followup-To: Srivatsa Vaddagiri , Alex Elder , Srinivas Kandagatla , Murali Nalajal , Trilok Soni , Carl van Schaik , Philip Derrin , Prakruthi Deepak Heragu , Jonathan Corbet , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Catalin Marinas , Will Deacon , Konrad Dybcio , Bjorn Andersson , Dmitry Baryshkov , Fuad Tabba , Sean Christopherson , Andrew Morton , linux-arm-msm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mm@kvack.org References: <20240222-gunyah-v17-0-1e9da6763d38@quicinc.com> <20240222-gunyah-v17-12-1e9da6763d38@quicinc.com> <20240311053806.GL440762@quicinc.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240311053806.GL440762@quicinc.com> X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: 11wI3OtaIF1Dwa5d3RYzieDVyHwG5GVf X-Proofpoint-ORIG-GUID: 11wI3OtaIF1Dwa5d3RYzieDVyHwG5GVf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-03-11_10,2024-03-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1011 mlxlogscore=999 spamscore=0 impostorscore=0 adultscore=0 phishscore=0 bulkscore=0 lowpriorityscore=0 suspectscore=0 priorityscore=1501 malwarescore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2403110131 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240311_101323_004353_CFBDA60A X-CRM114-Status: GOOD ( 24.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Mar 11, 2024 at 11:08:06AM +0530, Srivatsa Vaddagiri wrote: > * Elliot Berman [2024-02-22 15:16:35]: > > > Gunyah doesn't process the label and that makes it > > possible for userspace to create multiple resources with the same label. > > I think that description conflicts with what is implemented in this patch? > > int gunyah_vm_add_resource_ticket(struct gunyah_vm *ghvm, > struct gunyah_vm_resource_ticket *ticket) > { > mutex_lock(&ghvm->resources_lock); > list_for_each_entry(iter, &ghvm->resource_tickets, vm_list) { > if (iter->resource_type == ticket->resource_type && > iter->label == ticket->label) { > ret = -EEXIST; > goto out; > } > } > > > // > It's a justification for the next sentence in the commit text: Resource ticket owners need to be prepared for populate to be called multiple times if userspace created multiple resources with the same label. VM manager can make sure that only one entity is going to receive the resources (the check above you highlighted), but I can't make sure that it's only going to exactly one resource. We don't currently have a scenario where we need/want multiple resources with the same label, we might have that in the future and I didn't want to add that restriction in common code. > > @@ -134,6 +246,25 @@ static int gunyah_vm_start(struct gunyah_vm *ghvm) > > } > > ghvm->vm_status = GUNYAH_RM_VM_STATUS_READY; > > > > + ret = gunyah_rm_get_hyp_resources(ghvm->rm, ghvm->vmid, &resources); > > + if (ret) { > > + dev_warn(ghvm->parent, > > + "Failed to get hypervisor resources for VM: %d\n", > > + ret); > > + goto err; > > + } > > Where do we free memory pointed by 'resources' ptr? > Ah, I meant to add the __free(kfree) annotation. I've added it. > > + > > + for (i = 0, n = le32_to_cpu(resources->n_entries); i < n; i++) { > > + ghrsc = gunyah_rm_alloc_resource(ghvm->rm, > > + &resources->entries[i]); > > + if (!ghrsc) { > > + ret = -ENOMEM; > > + goto err; > > + } > > + > > + gunyah_vm_add_resource(ghvm, ghrsc); > > + } _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel