Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1942555imu; Sat, 12 Jan 2019 11:11:47 -0800 (PST) X-Google-Smtp-Source: ALg8bN54Ut0AXVOQS2gKktKtbib1DKtonOKVBx4mCTonDVDBbmdo4j3di/lmGbyZ1AXfgyOXLN8k X-Received: by 2002:a63:b81a:: with SMTP id p26mr17928812pge.433.1547320307496; Sat, 12 Jan 2019 11:11:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547320307; cv=none; d=google.com; s=arc-20160816; b=S8fNviIX8hzzs8ZcAiMLz4Siah2WbmBf7ajHCKEi1ohxIGznx8tEy8HDknJErGkr9b sTBpS9Ur3shGpcUxNAekgnhzmDEnxYX4eC5XljZj9NkwCreKisFxi/Y/95H5ds+Kv1yG mSn5pOzUFuXGV2Bf1qDZ+485fGRUu20I47wnbEROimYbb0uxQ9ue+gaQ0An+6K5i3kzQ Noyv019lgHvu7ZDZEexh0cXp8kCqceiCL6grd8EjwukU1rVlYKDP5VKgwViGLDuBH72L 0Ew+EwQ+geKATvVN3R7BMtIaukDUIZcR27+Kk8kskVIa/IuZXTRM05rpR+AaBROkVW7s mheQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=p29PLyr0BPhZLh5vERSIH6e/m0+cY7CVM5A2hjYAp+c=; b=QfAzYLr6oIuSjNvpnk4NPj2CfqfwEeA67wxmnDr+pGUMoD/Sl74C6Vw5TU8Zq071SF h8du44d/r+pxAGN8ciVy2QjxAaa7LZQiaNPhR+dES+V211j4e/8WEY+AAOO2jaaT5QTX n1mX8YJXyyISsKviplJ9obbNq97HZLvSV5/sFnLS6ahn5rK0jGCu0V5AXAtWXmjKilPo h+6RPbwtLzub6c9puxnMDQy2beCRJveMlCJLjuLF9U6br74eo8ROsz4Qy+4C0Pab4uwe 3H8jp2a/I4u+aKcodmxZi7IFd+Pa0030ko3TzPrRHoTam/ZJdHchmLWcLtaZoLO9hAdq aMZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aJgMTxdY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z14si23698982pga.349.2019.01.12.11.11.32; Sat, 12 Jan 2019 11:11:47 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aJgMTxdY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726639AbfALS2y (ORCPT + 99 others); Sat, 12 Jan 2019 13:28:54 -0500 Received: from mail-qk1-f193.google.com ([209.85.222.193]:34784 "EHLO mail-qk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725847AbfALS2x (ORCPT ); Sat, 12 Jan 2019 13:28:53 -0500 Received: by mail-qk1-f193.google.com with SMTP id q8so8443780qke.1; Sat, 12 Jan 2019 10:28:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=p29PLyr0BPhZLh5vERSIH6e/m0+cY7CVM5A2hjYAp+c=; b=aJgMTxdYxu8EapLVjUu0B/rxrL01uSkqoHjkaCdAV4L2f2XtKwHnNhnhEIuM4ITHnB ATYer4kTbREIA05CqwIoAACeUR37LR9d+tIEgPLoA+oeP8bAFR+dOxCPqnTdyb58t7gz 68GmP5i/5VhJ9x+1f06x/BbtGFRPiMiWSr1PNET6HBLnB4BQPNjTY9/hiLguSXRoNK0a Ba2DqceksTdHvgZlIaWXWvOnbqMqHgJxjxa+U7ctQzeD6pLEDmRnFRi5rtUq1OzwfMLc KQzh4snBN5JEyJdMfJGWvOeIdrDirqY2nZqxzhSD89bHp6Q9XZNsh6m0+UdQIbKCZOMN HFwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=p29PLyr0BPhZLh5vERSIH6e/m0+cY7CVM5A2hjYAp+c=; b=jvkw2oklehfe/3iKQyHlsXHBzycALO0pAC7zZzLD7Mg/+aJKj6OtTQ4teXVvwbL9vy 6sHWhvv4Vd+SG466OOgHjWkPHjN+PvTJIxa7kO0/z7l+CMEeogYGbEipRedt96e9km/i mg3H+Yux7TBBVo4z6kB+wAJ8XHW4pjZZP4g5qu4iqDdZyaGno39K36lzvdVaNTwIFwH1 RE+cSZpVdnVirYsCjBA85Ag7w3FdjArNcg75JvYo/l4tMrzhgiP0cLvO+exeWw1kM3eF xwq0yUzpZRUWmh99x8xWKOwD0pH30yVBjOhU0At2JGAersvVAJdVrK/RhXkGF3WEU6Qw xnvQ== X-Gm-Message-State: AJcUukcwgbR/Z8SU6RNdlszsgjFcwGvz5cE1CSu2r2nYjh8JZTZVNORG 5bnfO4npIaKzC0CpaXrDzu0s8FTc1nohTKCp9jk= X-Received: by 2002:a37:9442:: with SMTP id w63mr16717959qkd.109.1547317732561; Sat, 12 Jan 2019 10:28:52 -0800 (PST) MIME-Version: 1.0 References: <1547031403-34535-1-git-send-email-loic.pallardy@st.com> In-Reply-To: <1547031403-34535-1-git-send-email-loic.pallardy@st.com> From: xiang xiao Date: Sun, 13 Jan 2019 02:28:41 +0800 Message-ID: Subject: Re: [PATCH 1/1] remoteproc: fix recovery procedure To: Loic Pallardy Cc: bjorn.andersson@linaro.org, ohad@wizery.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, arnaud.pouliquen@st.com, benjamin.gaignard@linaro.org, s-anna@ti.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Loic, The change just hide the problem, I think. The big issue is: 1.virtio devices aren't destroyed by rpproc_stop 2.and then rpmsg child devices aren't destroyed too Then, when the remote start and create rpmsg channel again, the duplicated channel will appear in kernel. To fix this problem, we need go through rpproc_shutdown/rproc_boot to destroy all devices(virtio and rpmsg) and create them again. Thanks Xiang On Wed, Jan 9, 2019 at 6:56 PM Loic Pallardy wrote: > > Commit 7e83cab824a87e83cab824a8 ("remoteproc: Modify recovery path > to use rproc_{start,stop}()") replaces rproc_{shutdown,boot}() with > rproc_{stop,start}(), which skips destroy the virtio device at stop > but re-initializes it again at start. > > Issue is that struct virtio_dev is not correctly reinitialized like done > at initial allocation thanks to kzalloc() and kobject is considered as > already initialized by kernel. That is due to the fact struct virtio_dev > is allocated and released at vdev resource handling level managed and > virtio device is registered and unregistered at rproc subdevices level. > > This patch initializes struct virtio_dev to 0 before using it and > registering it. > > Fixes: 7e83cab824a8 ("remoteproc: Modify recovery path to use rproc_{start,stop}()") > > Reported-by: Xiang Xiao > Signed-off-by: Loic Pallardy > --- > drivers/remoteproc/remoteproc_virtio.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c > index 183fc42a510a..88eade99395c 100644 > --- a/drivers/remoteproc/remoteproc_virtio.c > +++ b/drivers/remoteproc/remoteproc_virtio.c > @@ -332,6 +332,8 @@ int rproc_add_virtio_dev(struct rproc_vdev *rvdev, int id) > struct virtio_device *vdev = &rvdev->vdev; > int ret; > > + /* Reset vdev struct as you don't know how it has been previously used */ > + memset(vdev, 0, sizeof(struct virtio_device)); > vdev->id.device = id, > vdev->config = &rproc_virtio_config_ops, > vdev->dev.parent = dev; > -- > 2.7.4 >