From patchwork Thu Feb 16 12:03:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrii Anisov X-Patchwork-Id: 9576981 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6463E600F6 for ; Thu, 16 Feb 2017 12:05:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A1C428578 for ; Thu, 16 Feb 2017 12:05:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5ED17285AD; Thu, 16 Feb 2017 12:05:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 05A5028578 for ; Thu, 16 Feb 2017 12:05:45 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ceKmk-0003bo-LE; Thu, 16 Feb 2017 12:03:42 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ceKmi-0003Yj-V7 for xen-devel@lists.xenproject.org; Thu, 16 Feb 2017 12:03:41 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id 17/6B-02139-C1595A85; Thu, 16 Feb 2017 12:03:40 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprPIsWRWlGSWpSXmKPExsXiVRvkois1dWm EwfSHuhbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bHDxeYCk6IVHTd9WhgfCnQxcjFISQwnVHi 6cKVjCAOi8BLFom9i64zdTFyckgI9LNKLN+oBGHHSGz42MUMYZdLTF99F6xGSEBNYt+h6ywQk 2YzSTz5s4IRJMEmoCtx/dUDsCIRASWJe6smM4EUMQt8YZS4/GEJWEJYwELi8KfXQA0cQKtVJT bfTwIJ8wq4SVz/95YVYpmcxM1znWCLOQXcJU6+fQq12E3ifncL2wRGgQWMDKsYNYpTi8pSi3S NDPSSijLTM0pyEzNzdA0NTPVyU4uLE9NTcxKTivWS83M3MQIDq56BgXEHY+Nsv0OMkhxMSqK8 P/qXRgjxJeWnVGYkFmfEF5XmpBYfYpTh4FCS4FWdApQTLEpNT61Iy8wBhjhMWoKDR0mE99lko DRvcUFibnFmOkTqFKMux65dl18yCbHk5eelSonzvgEpEgApyijNgxsBi7dLjLJSwryMDAwMQj wFqUW5mSWo8q8YxTkYlYR5S0Cm8GTmlcBtegV0BBPQEZ0RYEeUJCKkpBoYHVlbptpWJxvr31N euCBmzo4lT+ccMVvq7Tel/XiviL61dfri1Lc5/Eu3qYlXZbb+6FliJeeSkmtQ9Xa9XdjvyxzP Yio8L2g5dWYcODTxgOA87vOBkk7L+B8UB+omKc74lKTMrR957WWubqVO+9THYu9P75AWWNWz5 E/sWdO4V5kvtjKKuJ1UYinOSDTUYi4qTgQAetGnnrICAAA= X-Env-Sender: andrii.anisov@gmail.com X-Msg-Ref: server-13.tower-206.messagelabs.com!1487246618!69699563!1 X-Originating-IP: [74.125.82.68] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 11454 invoked from network); 16 Feb 2017 12:03:38 -0000 Received: from mail-wm0-f68.google.com (HELO mail-wm0-f68.google.com) (74.125.82.68) by server-13.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 16 Feb 2017 12:03:38 -0000 Received: by mail-wm0-f68.google.com with SMTP id r18so2771889wmd.3 for ; Thu, 16 Feb 2017 04:03:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tnuLYC+GKkGVjsddRQQBzVGk4ynr/HSE4aqkUPhG+00=; b=SES9pu582ZzH5KKC3k31Ze2rJ0XWagv850o6kemqa6P9A6UoSiHEKPfIxxOn3ZFIRq /MtkHQI7JjJaeeI7CorPuERT10vlspwkAS5Iy/iCAyBzfRigzHuZkF445f9Ex61raMDa cghjo2R4AQqb2k4DWAoVyWYbSSJ/kbQXENESBgpzgY6zeUhGmd+tcLmiwwvD6+S8KRgb eU44tjYBv2QdISv4lbA1DVcbnorPswM6J2QkBaoi8BehUVfVCwpWJuXy6JI8n+6Yr4bt TX+PcPmF6OXqyY1j4xIBwHmVyIBRltsAUIe8WcEWW40MvaPgUJ4ytrLYVKScxhAZ5oyg vtOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tnuLYC+GKkGVjsddRQQBzVGk4ynr/HSE4aqkUPhG+00=; b=gC3i5Qo6RGn52gNvaD/fi083hsMactDWonXan8wOy6qfX/rlHktzIteZiEI30O6630 Jh8Oi3RhsJx6auCw0AS48Pi0hCyOEZt2YIZtTdwIHelAlidw7R1m+CWMBkFL/xanWT9l ckPz1cUVhwZi2AlEWzUDZ7KtlBxplY9jGl9jMHif5KPE8v1wawjA5kyPBcBNtMexf5gI uqEc0UE9a7gQHuR74MK9hRqJbjbaVKu9DmXbi97b69GOwgS0JTdoCoS7szKa8TnG8+5I Go228y2fgkN1TucZEshwAMkxTG9Tj5JEmrPy8ayoVbJ7uEF/CULUZc11rb+61dYnRSim VQ9Q== X-Gm-Message-State: AMke39l9PRFz4guVt+jT8btXReRjjYXlOCKDZ0onk25pKIPbwpTB7hNMRKr8PP0l5w9Lhg== X-Received: by 10.28.68.10 with SMTP id r10mr2194840wma.68.1487246618432; Thu, 16 Feb 2017 04:03:38 -0800 (PST) Received: from aanisov-work.kyiv.epam.com (ll-74.141.223.85.sovam.net.ua. [85.223.141.74]) by smtp.gmail.com with ESMTPSA id w30sm8754047wrb.5.2017.02.16.04.03.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 16 Feb 2017 04:03:37 -0800 (PST) From: Andrii Anisov To: xen-devel@lists.xenproject.org Date: Thu, 16 Feb 2017 14:03:28 +0200 Message-Id: <1487246610-8298-5-git-send-email-andrii.anisov@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487246610-8298-1-git-send-email-andrii.anisov@gmail.com> References: <1487246610-8298-1-git-send-email-andrii.anisov@gmail.com> Cc: sstabellini@kernel.org, andrii_anisov@epam.com, George.Dunlap@eu.citrix.com, andrew.cooper3@citrix.com, ian.jackson@eu.citrix.com, tim@xen.org, paul.durrant@citrix.com, jbeulich@suse.com, wei.liu2@citrix.com Subject: [Xen-devel] [RFC 4/6] rangeset_domain_destroy() refactoring X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Andrii Anisov rangeset_domain_destroy() is rather rangeset list helper and does nothing really domain specific. So replace it with rangeset_list_destroy() helper. Signed-off-by: Andrii Anisov --- xen/common/domain.c | 4 ++-- xen/common/rangeset.c | 11 ++++------- xen/include/xen/rangeset.h | 9 ++------- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/xen/common/domain.c b/xen/common/domain.c index 7fe69c6..47c45f2 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -420,7 +420,7 @@ struct domain *domain_create(domid_t domid, unsigned int domcr_flags, radix_tree_destroy(&d->pirq_tree, free_pirq_struct); } if ( init_status & INIT_rangeset ) - rangeset_domain_destroy(d); + rangeset_list_destroy(&d->rangesets); if ( init_status & INIT_watchdog ) watchdog_domain_destroy(d); if ( init_status & INIT_xsm ) @@ -815,7 +815,7 @@ static void complete_domain_destroy(struct rcu_head *head) watchdog_domain_destroy(d); - rangeset_domain_destroy(d); + rangeset_list_destroy(&d->rangesets); sched_destroy_domain(d); diff --git a/xen/common/rangeset.c b/xen/common/rangeset.c index 1a13a32..a8b5a5d 100644 --- a/xen/common/rangeset.c +++ b/xen/common/rangeset.c @@ -381,20 +381,17 @@ void rangeset_limit( r->nr_ranges = limit; } -void rangeset_domain_destroy( - struct domain *d) +void rangeset_list_destroy(struct list_head *list) { struct rangeset *r; - while ( !list_empty(&d->rangesets) ) + while ( !list_empty(list) ) { - r = list_entry(d->rangesets.next, struct rangeset, rangeset_list); + r = list_entry(list->next, struct rangeset, rangeset_list); - BUG_ON(r->domain != d); - r->domain = NULL; list_del(&r->rangeset_list); - rangeset_destroy(r); + rangeset_destroy(r, NULL); } } diff --git a/xen/include/xen/rangeset.h b/xen/include/xen/rangeset.h index e8244a0..cc795d1 100644 --- a/xen/include/xen/rangeset.h +++ b/xen/include/xen/rangeset.h @@ -18,14 +18,9 @@ struct spinlock; struct rangeset; /* - * Destroy per-domain rangeset information. - * - * It is invalid to create or destroy a rangeset belonging to a domain @d - * before rangeset_domain_initialise(d) returns or after calling - * rangeset_domain_destroy(d). + * Destroy a list of rangesets. */ -void rangeset_domain_destroy( - struct domain *d); +void rangeset_list_destroy(struct list_head *list); /* * Create a rangeset. Optionally attach to a specified list @head.