From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932894Ab2IGJ3n (ORCPT ); Fri, 7 Sep 2012 05:29:43 -0400 Received: from mail-we0-f174.google.com ([74.125.82.174]:46243 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755886Ab2IGJ3l (ORCPT ); Fri, 7 Sep 2012 05:29:41 -0400 MIME-Version: 1.0 In-Reply-To: <20120905191657.GA15868@redhat.com> References: <1346680277-5887-1-git-send-email-sjur.brandeland@stericsson.com> <20120903143018.GA5353@redhat.com> <20120903202737.GD6181@redhat.com> <87zk56e2xc.fsf@rustcorp.com.au> <20120905143558.GB10925@redhat.com> <20120905191657.GA15868@redhat.com> Date: Fri, 7 Sep 2012 11:24:24 +0200 Message-ID: Subject: Re: [RFC 1/2] virtio_console: Add support for DMA memory allocation From: =?UTF-8?Q?Sjur_Br=C3=A6ndeland?= To: "Michael S. Tsirkin" Cc: Rusty Russell , Ohad Ben-Cohen , Amit Shah , linux-kernel@vger.kernel.org, Linus Walleij , virtualization@lists.linux-foundation.org Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Michael. >> Not just fail to work, the kernel will panic on the BUG_ON(). >> Remoteproc gets the virtio configuration from firmware loaded >> from user space. So this type of problem might be triggered >> for other virtio drivers as well. > > how? ... >> Even if we fix this particular problem, the general problem >> still exists: bogus virtio declarations in remoteproc's firmware >> may cause BUG_ON(). > > which BUG_ON exactly? I am afraid I have been barking up the wrong tree here. Please ignore my previous rambling about panics related to device features. I hit the BUG() in virtio_check_driver_offered_feature(): First I did not declare the feature because DMA was not set: static unsigned int features[] = { ... #if VIRTIO_CONSOLE_HAS_DMA VIRTIO_CONSOLE_F_DMA_MEM, #endif }; and then in probe I checked if the feature was supported: virtio_has_feature(vdev, VIRTIO_CONSOLE_F_DMA_MEM) This triggered the BUG() in virtio_check_driver_offered_feature(), because the driver was asking for a unknown-feature. I can get avoid this by simply checking the devices feature bits directly instead of using virtio_has_feature(). Regards, Sjur