From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE659C433DF for ; Fri, 21 Aug 2020 11:39:58 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B6E002078B for ; Fri, 21 Aug 2020 11:39:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=yadro.com header.i=@yadro.com header.b="MNbyrsFr" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B6E002078B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=yadro.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:51450 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k95On-0007WO-Tp for qemu-devel@archiver.kernel.org; Fri, 21 Aug 2020 07:39:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38314) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k94gR-00043f-6K; Fri, 21 Aug 2020 06:54:07 -0400 Received: from mta-02.yadro.com ([89.207.88.252]:57210 helo=mta-01.yadro.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k94gK-0005II-U5; Fri, 21 Aug 2020 06:54:06 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-01.yadro.com (Postfix) with ESMTP id 23706574ED; Fri, 21 Aug 2020 10:53:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yadro.com; h= in-reply-to:content-disposition:content-type:content-type :mime-version:references:message-id:subject:subject:from:from :date:date:received:received:received; s=mta-01; t=1598007235; x=1599821636; bh=aDNQCIk4AbizCxvc3FytHfG88CXeatRS0JwlmnDZoHs=; b= MNbyrsFr49PxjVn0azynTz0LtCXzOsncJaDtYNMCoWaMNNaVCRvHPdUcWKI0QVU+ A6PkaenRzP8XIwO/jWnpq/0zxh7Gg5uuy/aC9569bjjJWFRzTAPgs3i0c8IS93JZ dHfaZhV2pJYVfYWL/nbiczQic1cvhkLVx+o8Z9reyAg= X-Virus-Scanned: amavisd-new at yadro.com Received: from mta-01.yadro.com ([127.0.0.1]) by localhost (mta-01.yadro.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id p9pgP2Uiji3Y; Fri, 21 Aug 2020 13:53:55 +0300 (MSK) Received: from T-EXCH-02.corp.yadro.com (t-exch-02.corp.yadro.com [172.17.10.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mta-01.yadro.com (Postfix) with ESMTPS id DC9BA52195; Fri, 21 Aug 2020 13:53:53 +0300 (MSK) Received: from localhost (172.17.204.212) by T-EXCH-02.corp.yadro.com (172.17.10.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.669.32; Fri, 21 Aug 2020 13:53:53 +0300 Date: Fri, 21 Aug 2020 13:53:52 +0300 From: Roman Bolshakov To: Eduardo Habkost Subject: Re: Suspicious QOM types without instance/class size Message-ID: <20200821105352.GA89922@SPB-NB-133.local> References: <20200820215529.GH642093@habkost.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20200820215529.GH642093@habkost.net> X-Originating-IP: [172.17.204.212] X-ClientProxiedBy: T-EXCH-01.corp.yadro.com (172.17.10.101) To T-EXCH-02.corp.yadro.com (172.17.10.102) Received-SPF: pass client-ip=89.207.88.252; envelope-from=r.bolshakov@yadro.com; helo=mta-01.yadro.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/21 06:53:56 X-ACL-Warn: Detected OS = Linux 3.11 and newer X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng , Peter Maydell , "Michael S. Tsirkin" , Mark Cave-Ayland , qemu-devel@nongnu.org, Gerd Hoffmann , qemu-block@nongnu.org, David Hildenbrand , Halil Pasic , Christian Borntraeger , =?iso-8859-1?Q?Herv=E9?= Poussineau , David Gibson , Thomas Huth , Alistair Francis , Cameron Esfahani , qemu-s390x@nongnu.org, qemu-arm@nongnu.org, =?iso-8859-1?Q?C=E9dric?= Le Goater , Richard Henderson , "Daniel P. Berrange" , Cornelia Huck , qemu-ppc@nongnu.org, Paolo Bonzini Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Thu, Aug 20, 2020 at 05:55:29PM -0400, Eduardo Habkost wrote: > While trying to convert TypeInfo declarations to the new > OBJECT_DECLARE* macros, I've stumbled on a few suspicious cases > where instance_size or class_size is not set, despite having type > checker macros that use a specific type. > > The ones with "WARNING" are abstract types (maybe not serious if > subclasses set the appropriate sizes). The ones with "ERROR" > don't seem to be abstract types. > > ERROR: target/i386/hvf/hvf.c:908:1: instance_size should be set to sizeof(HVFState)? Hi Eduardo, How do you get the error? Given your changes, instance size should really be sizeof(HVFState). BTW, the object definition for hvf seems different from KVM (and perhaps wrong?), e.g. HVFState is allocated within init_machine handler and then assigned to a global variable: static int hvf_accel_init(MachineState *ms) { int x; hv_return_t ret; HVFState *s; ret = hv_vm_create(HV_VM_DEFAULT); assert_hvf_ok(ret); s = g_new0(HVFState, 1); s->num_slots = 32; for (x = 0; x < s->num_slots; ++x) { s->slots[x].size = 0; s->slots[x].slot_id = x; } hvf_state = s; cpu_interrupt_handler = hvf_handle_interrupt; memory_listener_register(&hvf_memory_listener, &address_space_memory); return 0; } static void hvf_accel_class_init(ObjectClass *oc, void *data) { AccelClass *ac = ACCEL_CLASS(oc); ac->name = "HVF"; ac->init_machine = hvf_accel_init; ac->allowed = &hvf_allowed; } static const TypeInfo hvf_accel_type = { .name = TYPE_HVF_ACCEL, .parent = TYPE_ACCEL, .class_init = hvf_accel_class_init, }; Thanks, Roman