From patchwork Fri Apr 12 06:53:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dongli Zhang X-Patchwork-Id: 10897309 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7206D1708 for ; Fri, 12 Apr 2019 06:51:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2332B28E1D for ; Fri, 12 Apr 2019 06:51:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1681728E49; Fri, 12 Apr 2019 06:51: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=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9AD8E28E1D for ; Fri, 12 Apr 2019 06:51:45 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hEq0P-0007es-GV; Fri, 12 Apr 2019 06:49:45 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hEq0O-0007en-1l for xen-devel@lists.xenproject.org; Fri, 12 Apr 2019 06:49:44 +0000 X-Inumbo-ID: 26353252-5cef-11e9-92d7-bc764e045a96 Received: from userp2120.oracle.com (unknown [156.151.31.85]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 26353252-5cef-11e9-92d7-bc764e045a96; Fri, 12 Apr 2019 06:49:42 +0000 (UTC) Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3C6hlpR027871; Fri, 12 Apr 2019 06:49:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2018-07-02; bh=b7woYrl63pNzcetbuxkWEBWjxuHs1pmlo0Ddo71dyWQ=; b=nIWY84tu+RXJHdzCGV6r64TEivap4dNZvCegmI4gRHq+X8s2Y4oU7kWuFuZU016DjV0d U508suIxDuzw0uS5AngC+pZtpmbA6gPgGFAI7WYo/nL6UC5afA7kxXVg/+0pHcepCUpS okEsJpo0eXXywsIPhOXKZaHL3WywFCLdOPr67t8zyZEHcG1WuVN1HFMAVdTGdoCHbSEG vnedqQk8pguK8+AbnVED+ArPl1fsxk377ekC0x0kJs7eYeQFTAYfFzNqJKP2NzRHyAAL HdP4VkFJ9SCebx78Juxu68HHBBKR+ZnUp0xLW56BZHD1V6OwqMVjoo5j+iFS4wzaVvoN Tw== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2120.oracle.com with ESMTP id 2rpmrqmmu3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Apr 2019 06:49:36 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x3C6m94s189407; Fri, 12 Apr 2019 06:49:35 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 2rt9uq0pjb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Apr 2019 06:49:35 +0000 Received: from abhmp0007.oracle.com (abhmp0007.oracle.com [141.146.116.13]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x3C6nYDd018876; Fri, 12 Apr 2019 06:49:34 GMT Received: from linux.cn.oracle.com (/10.182.69.106) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 11 Apr 2019 23:49:33 -0700 From: Dongli Zhang To: xen-devel@lists.xenproject.org, netdev@vger.kernel.org Date: Fri, 12 Apr 2019 14:53:24 +0800 Message-Id: <1555052004-31855-1-git-send-email-dongli.zhang@oracle.com> X-Mailer: git-send-email 2.7.4 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9224 signatures=668685 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-1810050000 definitions=main-1904120046 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9224 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1904120046 Subject: [Xen-devel] [PATCH 1/1] xen-netback: add reference from xenvif to backend_info to facilitate coredump analysis X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: wei.liu2@citrix.com, joe.jin@oracle.com, linux-kernel@vger.kernel.org, junxiao.bi@oracle.com, paul.durrant@citrix.com, jie.l.li@oracle.com, davem@davemloft.net MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP During coredump analysis, it is not easy to obtain the address of backend_info in xen-netback. So far there are two ways to obtain backend_info: 1. Do what xenbus_device_find() does for vmcore to find the xenbus_device and then derive it from dev_get_drvdata(). 2. Extract backend_info from callstack of xenwatch (e.g., netback_remove() or frontend_changed()). This patch adds a reference from xenvif to backend_info so that it would be much more easier to obtain backend_info during coredump analysis. Signed-off-by: Dongli Zhang Acked-by: Wei Liu --- drivers/net/xen-netback/common.h | 18 ++++++++++++++++++ drivers/net/xen-netback/xenbus.c | 17 +---------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/drivers/net/xen-netback/common.h b/drivers/net/xen-netback/common.h index 936c0b3..05847eb 100644 --- a/drivers/net/xen-netback/common.h +++ b/drivers/net/xen-netback/common.h @@ -248,6 +248,22 @@ struct xenvif_hash { struct xenvif_hash_cache cache; }; +struct backend_info { + struct xenbus_device *dev; + struct xenvif *vif; + + /* This is the state that will be reflected in xenstore when any + * active hotplug script completes. + */ + enum xenbus_state state; + + enum xenbus_state frontend_state; + struct xenbus_watch hotplug_status_watch; + u8 have_hotplug_status_watch:1; + + const char *hotplug_script; +}; + struct xenvif { /* Unique identifier for this interface. */ domid_t domid; @@ -283,6 +299,8 @@ struct xenvif { struct xenbus_watch credit_watch; struct xenbus_watch mcast_ctrl_watch; + struct backend_info *be; + spinlock_t lock; #ifdef CONFIG_DEBUG_FS diff --git a/drivers/net/xen-netback/xenbus.c b/drivers/net/xen-netback/xenbus.c index 330ddb6..41c9e8f 100644 --- a/drivers/net/xen-netback/xenbus.c +++ b/drivers/net/xen-netback/xenbus.c @@ -22,22 +22,6 @@ #include #include -struct backend_info { - struct xenbus_device *dev; - struct xenvif *vif; - - /* This is the state that will be reflected in xenstore when any - * active hotplug script completes. - */ - enum xenbus_state state; - - enum xenbus_state frontend_state; - struct xenbus_watch hotplug_status_watch; - u8 have_hotplug_status_watch:1; - - const char *hotplug_script; -}; - static int connect_data_rings(struct backend_info *be, struct xenvif_queue *queue); static void connect(struct backend_info *be); @@ -472,6 +456,7 @@ static int backend_create_xenvif(struct backend_info *be) return err; } be->vif = vif; + vif->be = be; kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE); return 0;