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=-5.3 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 D92FDC433DF for ; Sat, 15 Aug 2020 15:18:04 +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 9D97E2310F for ; Sat, 15 Aug 2020 15:18:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="sx0twEdK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9D97E2310F Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:58976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k6xwZ-00032K-T9 for qemu-devel@archiver.kernel.org; Sat, 15 Aug 2020 11:18:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:54160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k6xph-0001AU-UJ for qemu-devel@nongnu.org; Sat, 15 Aug 2020 11:10:57 -0400 Received: from mail-oi1-x243.google.com ([2607:f8b0:4864:20::243]:36065) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1k6xpg-0000Ic-4p for qemu-devel@nongnu.org; Sat, 15 Aug 2020 11:10:57 -0400 Received: by mail-oi1-x243.google.com with SMTP id l204so10830715oib.3 for ; Sat, 15 Aug 2020 08:10:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=4Rvz56oO5wS/gMgAnvaeiayH0Bj18HTZcfeBlsrcvaU=; b=sx0twEdKFmR1s1b/dP1mQSBuUNbQdOfQHeh7IlxU0ysmGTucYigzneu4qe2kIOY+WS cz4zWnBzeuHgOuGEA7mrZHfxkjFyLknxaJNYB34UUb4GCU64hoCC8GmU10Drs+FPQJNM 7Vd60kPL8jshCIBki9EFqG6lvXJXALjobFsfh2U6xgRpM+AyS82GFJXxJQQbMhD7Ju6+ cV/1S8sZbT9wzdveN4KH17CiQaS2FNsWfi+Y+4zXO/hd+8boAlnhMgdsw0SyjbRQhEeF DgYRakxscZhZelH/WBQGbPozFYYppys7TAhgURYHSNtz5EMb0zpqLBZhS8kYHTHY/BY8 CAIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4Rvz56oO5wS/gMgAnvaeiayH0Bj18HTZcfeBlsrcvaU=; b=br+2cPmB450yQhdC1We4sjLVwoLwvgkZRg94oe8QbxBMBScRUrbhC1viBNfugZxJDK 8Rv5xP76/5HnvXlYNspFQylxsuYIL5XIDgV2RF3A1I/ypCxJqnMlnQS6tFi5goaeefTT xD7UVij4vNjj65Co+e7dobch2qmWzFejYLq7vD/ZVHXEehOfzTBA9Ih75/yP3BP4EsPf xVu88prxrWuCkTui/0Ef2871SI/JiInYoDtZS+8kDENoqAiw77lbKyqtVfKlQHBEO7rb Je+EJIG01D/1KYmqtKkl5Aofkw3Um91kMJUNhjk6CfQ9rcsyPgMLA9QKY6XRAu572GqO VGTA== X-Gm-Message-State: AOAM5329nrhexc6aImIGJ+BnT1KwgfF/ENU6NljCekHX7u5O4Lw0jQf2 JkJCCkSMcfn52oxS+C2My5hXZwA2GHd0ng== X-Google-Smtp-Source: ABdhPJwtioCtXoEeUPyW18e1rdlB07N3HB8mkB+aEIlDmV+9i60+5GQMeqI0BovQBokdEqpZWU283g== X-Received: by 2002:a17:90b:3009:: with SMTP id hg9mr3599594pjb.38.1597438864337; Fri, 14 Aug 2020 14:01:04 -0700 (PDT) Received: from [192.168.1.11] ([71.212.141.89]) by smtp.gmail.com with ESMTPSA id o134sm10019221pfg.200.2020.08.14.14.01.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Aug 2020 14:01:03 -0700 (PDT) Subject: Re: [PATCH v5 10/14] cpus: add handle_interrupt to the CpusAccel interface To: Claudio Fontana , Paolo Bonzini , =?UTF-8?Q?Alex_Benn=c3=a9e?= , Peter Maydell , =?UTF-8?Q?Philippe_Mathieu-Daud=c3=a9?= , Roman Bolshakov References: <20200812183250.9221-1-cfontana@suse.de> <20200812183250.9221-11-cfontana@suse.de> From: Richard Henderson Message-ID: Date: Fri, 14 Aug 2020 14:01:01 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200812183250.9221-11-cfontana@suse.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=2607:f8b0:4864:20::243; envelope-from=richard.henderson@linaro.org; helo=mail-oi1-x243.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-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: Laurent Vivier , Thomas Huth , Eduardo Habkost , Marcelo Tosatti , qemu-devel@nongnu.org, Markus Armbruster , Pavel Dovgalyuk , Wenchao Wang , haxm-team@intel.com, Sunil Muthuswamy , Richard Henderson , Colin Xu Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On 8/12/20 11:32 AM, Claudio Fontana wrote: > +static void generic_handle_interrupt(CPUState *cpu, int mask) > +{ > + cpu->interrupt_request |= mask; > + > + if (!qemu_cpu_is_self(cpu)) { > + qemu_cpu_kick(cpu); > + } > +} > + > +void cpu_interrupt(CPUState *cpu, int mask) > +{ > + if (cpus_accel && cpus_accel->handle_interrupt) { > + cpus_accel->handle_interrupt(cpu, mask); > + } else { > + generic_handle_interrupt(cpu, mask); > + } > +} First, by this point you have converted all of the accelerators, so I would expect cpus_accel to always be non-null. I would expect a patch immediately preceding this one to place an assert to that effect somewhere in the startup code, and to remove all of the checks. Second, I would prefer that all methods be non-null, so that you don't need to check that either. This patch would add generic_handle_interrupt (perhaps named cpus_accel_default_handle_interrupt declared in sysemu/cpus.h?) to the CpusAccel structure of all except TCG. Similarly for all other methods that are checking non-null-ness of the method pointer. Perhaps assert non-null for each method in cpus_register_accel(). r~