From nobody Tue May 21 17:14:57 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1659527572; cv=none; d=zohomail.com; s=zohoarc; b=CbS2jC79QEYuCkE8zlzUXMoy0iEeM3if2QOQNWbBhnPfNrgTroVGJo21b597CWGDE/4A4jpmHxthBLKo8+08hyXx2W89i9WyUcR+AZMDT5P2mpK67YVzWso/cX7K4TJNnlDUYzz+qF9/8+KH3HB9qKDkanyRQ9W6LA5rLcNnCnU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1659527572; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=K9F/kmoOpeppu6WnUx7xWkcRUOv3iONMMKz7RqEfDmU=; b=IZwKuT55m4uMmN5XPcKsuWzi/Rb0YA7JEPK3FBG3otIWLB8qGp43uw2sC8/+iK4dRyTQcnPaXbgbfD9P1xy/C/CvdjEdox4/bsnEusDIQJlnwbLjU5muLmuRgUQ/11097jvF+ZdqN4gcZJC7HZxdKM0/dlMd7BmQjexFshu9W8M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 165952757261924.70454931681718; Wed, 3 Aug 2022 04:52:52 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-552-0TGICmrsMBCFGXduN1FWjg-1; Wed, 03 Aug 2022 07:52:47 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8BF9F8032F6; Wed, 3 Aug 2022 11:52:45 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC8591415116; Wed, 3 Aug 2022 11:52:44 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id ABAEF1946A50; Wed, 3 Aug 2022 11:52:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 965501946A50 for ; Wed, 3 Aug 2022 11:52:43 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 8844C40CF8F0; Wed, 3 Aug 2022 11:52:43 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.227]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6A192400DEF8 for ; Wed, 3 Aug 2022 11:52:43 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 593962402DF; Wed, 3 Aug 2022 13:52:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1659527571; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=K9F/kmoOpeppu6WnUx7xWkcRUOv3iONMMKz7RqEfDmU=; b=UAgA2Q7cshxTuvHsNIgjB9Lww50mTAuHp5CAsbnErcmefnICjlaxhsPJa3DOPDzkWLmYZv 4ajR24ucCUqj7kH1rJmaGJGOASuV6ZFY3lYY5YGoOvnCA8gch4C4JRlOeS0lDQoBvPHJaE TRthSVev6s+jnc3N+xHM3WqwbA9SpGg= X-MC-Unique: 0TGICmrsMBCFGXduN1FWjg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Jiri Denemark To: libvir-list@redhat.com Subject: [libvirt PATCH] qemu: Do not try to set memlock on inactive domain Date: Wed, 3 Aug 2022 13:52:41 +0200 Message-Id: <31d321fe4c06bbf872ee3d0f4e34e2034c4912b9.1659527560.git.jdenemar@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1659527574021100001 Content-Type: text/plain; charset="utf-8" When we call qemuDomainSetMaxMemLock to reset memory locking limit back to its original value the domain can already be stopped (for example after the domain shuts down during migration) in which case it does not make sense to set any limit. Doing so can even be harmful as we may end up setting the limit for the daemon itself as the PID is 0. Signed-off-by: Jiri Denemark Reviewed-by: Pavel Hrdina --- src/qemu/qemu_domain.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 12c58a25b9..ad6c614d89 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -9461,6 +9461,10 @@ qemuDomainSetMaxMemLock(virDomainObj *vm, { unsigned long long current =3D 0; =20 + /* nothing to do if the domain is not running */ + if (vm->pid <=3D 0) + return 0; + if (virProcessGetMaxMemLock(vm->pid, ¤t) < 0) return -1; =20 --=20 2.35.1