Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp5388920rwb; Tue, 17 Jan 2023 13:05:46 -0800 (PST) X-Google-Smtp-Source: AMrXdXt2S7AXUFGSKybOPIAOOJyNqwrceS7IL2EEjNwvvqT/map7aNQfFGpS5umezr+Bpi1P1x2D X-Received: by 2002:a05:6a20:2a83:b0:b8:6c02:549b with SMTP id v3-20020a056a202a8300b000b86c02549bmr6348072pzh.7.1673989545889; Tue, 17 Jan 2023 13:05:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673989545; cv=none; d=google.com; s=arc-20160816; b=n1LFJGbcOQVK0SjksmOlipvot8BXAgbW+0axRYP1n/lLjQP3ZgAouUHVEpNNgXQcgK 30/0LHRQG3vT4gU8CF/i66JAVS2g0SsBzahTNkQPEbZJUxcST0dkrqBrUYlY+I5DQ3sS Ejr5f+hkn1w6U/4STYgyZKB8+FUy7KR3FfW+1gCSsTp1ZXXoPGzqk+TwaBSAqehB/VmM EjtWU2ujgi61XK1DiMyloGcV/HeWbn7GyqnIAYtTv6Lt2YnF1qI2r/AKczC6dNDdQWPl +A2obo+lVYdXtx4zRKTqYnF80zEiYIROLdZeBuAZ5RPF9PX6KQGGCpuDCXXqFdqwdviw Hq8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id:dkim-signature; bh=X6QGAdbpO4js38m8kqmMNfNj0cJL5DAjxA6pYUNKH30=; b=tiWrHrKz6Szh17Bk88T6p/BfmwbLqNs8z9qdCbtVo9zBbjLZc9/zOLm23okWG0nwYY 2cboYEez09qALMxkiTKJD4E+0SBaGrJsZ6nxvOeZ5wrOcAej4vYYJX1D3Ai/5fer7Nym FxRLJ/8qe4SmnnuFZ27TZ1iLW5cbp/GcW0xkfmEqEhYlEKDkPV8iDJi1K88M96n3KxtZ VIgq2Q9BaZ9TY59Y15NZpa0dhOgwdqFM5teF8MWOafgQlJFKtGA7oMJHIY2rA9MUzGSu qW6isAq/8Z9Lb3OCkTu1P0igIU44YpMQUbVjd0PHeNv3FkP26MNsPuHumNofwWQ/Sl/Q SM4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EGBN80wb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m8-20020a170902f64800b001926aa9f47csi32707345plg.334.2023.01.17.13.05.38; Tue, 17 Jan 2023 13:05:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=EGBN80wb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232094AbjAQUmz (ORCPT + 47 others); Tue, 17 Jan 2023 15:42:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54240 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232584AbjAQUgx (ORCPT ); Tue, 17 Jan 2023 15:36:53 -0500 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 583122C65A for ; Tue, 17 Jan 2023 11:21:15 -0800 (PST) Received: by mail-il1-x12d.google.com with SMTP id i17so11050462ila.9 for ; Tue, 17 Jan 2023 11:21:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=X6QGAdbpO4js38m8kqmMNfNj0cJL5DAjxA6pYUNKH30=; b=EGBN80wbBUdJj7Z/jkUWK5AFLeZOZLo5xHgOEl0PgXYrOSfBG/7dnDJbzvQhOya/ow +jy6ommn0FNq4Wqq83QTFAnhPeX4dDoMUIcfN2dIoY9l4OGUdsYixaaM17Ae+x1IkV8X xGy/1xQdE/J2mTBTSTAwy0GrYJTbaUjoANEguiNcpC5TV2IqfcMURDnsGu5H6RmCm7RY ZlSXTTrU34trY64Y/VT6wmqHwm+9puSKKQDZBIjr3mHpp+++7lx7kTP1g7LiYlDtyZso zzQmejXLekCZG+ZaIwtd1vNYDstgwiSpx9kTxioziEPC6gexAocnuxZtPD1IJrJLBlRe RuIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=X6QGAdbpO4js38m8kqmMNfNj0cJL5DAjxA6pYUNKH30=; b=Zxn19nQdQfts76jpwsAat06GRsen2vnnPmapRl/sgsonM2lmrzpB42JwGQj+vqVqhM /9H/FSgRfmGbj9qPbOhaSFM3GHAB8mVZZAZ5D44ptbrxK4sdHKprkMqY3YuerpbC4SwO ivDVkZcqlnLucfRzjdSTa6AV3KcKlS9XPgChSHIqsOCN7rozYAL+3cln5fNPL5pAjSP3 qe6cLVFCajH7y7LSL0NeMOmV3xxJgivSVOLLfBMIGCo1+IpW3NtbfpmRLj4l/XW/v7fB JjMlDZBpWCx4Snx9ok/ZIiKbzZmwlnR/BMvfcntSZCZyikmCSpL2Q9tuSKHkrJsQnY5O Pnuw== X-Gm-Message-State: AFqh2krdmD5JmLDCPiaxMiRpTAHa3aGJ3cGLw0falRYJ+f5mSiKRnXzM 8vnHdvykUoI0dacx4MEw+xtpaA== X-Received: by 2002:a92:d6c6:0:b0:304:c91b:4a5c with SMTP id z6-20020a92d6c6000000b00304c91b4a5cmr3292929ilp.24.1673983274699; Tue, 17 Jan 2023 11:21:14 -0800 (PST) Received: from [172.22.22.4] ([98.61.227.136]) by smtp.googlemail.com with ESMTPSA id l3-20020a056e0205c300b0030f1be2e051sm811189ils.39.2023.01.17.11.21.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 17 Jan 2023 11:21:14 -0800 (PST) Message-ID: <65af5abc-3719-95fe-041c-67d1d146aba1@linaro.org> Date: Tue, 17 Jan 2023 13:21:13 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 From: Alex Elder Subject: Re: [PATCH v8 09/28] mailbox: Add Gunyah message queue mailbox To: Elliot Berman , Alex Elder , Bjorn Andersson , Jassi Brar , Murali Nalajala , Jonathan Corbet Cc: Trilok Soni , Srivatsa Vaddagiri , Carl van Schaik , Prakruthi Deepak Heragu , Arnd Bergmann , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Bagas Sanjaya , Catalin Marinas , Will Deacon , Sudeep Holla , Mark Rutland , Lorenzo Pieralisi , Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org References: <20221219225850.2397345-1-quic_eberman@quicinc.com> <20221219225850.2397345-10-quic_eberman@quicinc.com> <4e064b55-22fd-5f29-620b-715a5d822a75@linaro.org> Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/10/23 12:16 PM, Elliot Berman wrote: >>> +    ret = gh_hypercall_msgq_send(msgq->tx_ghrsc->capid, >>> msgq_data->length, >>> +                    (uintptr_t)msgq_data->data, tx_flags, &ready); >>> + >>> +    /** >>> +     * unlikely because Linux tracks state of msgq and should not >>> try to >>> +     * send message when msgq is full. >>> +     */ >> >> Is it just unlikely, or is it impossible? >> > > This would require multiple mailbox controllers interacting with the > same message queue. > > The only way I can think this is possible is if the Gunyah drivers are > unloaded when the message queue is full; drivers are then re-loaded > before the receiver processes the messages. The initial internal state > of the message queue controller assumes that there is space in the > message queue. We would get a Tx vIRQ once space becomes available and > the message would then be attempted to sent again. Since there's a safe > flow to recover from a inconsistent internal state and it's very > unlikely to start in that state, I don't think we need to add calls to > check if the message queue is full during initialization. First, your explanation is appreciated but more than what I was looking for... I just mentioned it because if it were impossible, then there's no point in having this code handle something that literally can't happen. But as far as your explanation, I *hope* if the Gunyah drivers are unloaded, everything gets fully cleaned up before that completes. There should be no in-flight activity, or any "previous generation" messages that could be processed. In any case, I think my question is answered. Thanks. -Alex