Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1010433ybb; Fri, 3 Apr 2020 16:20:42 -0700 (PDT) X-Google-Smtp-Source: APiQypIMCbdG1X6OOzmSBEQ0NJHqHZU/e4xKh4e610i49tsuw/LmCWjuEHz/5+bwjs8jzbmhjF0K X-Received: by 2002:a4a:3f19:: with SMTP id e25mr8818572ooa.67.1585956042811; Fri, 03 Apr 2020 16:20:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585956042; cv=none; d=google.com; s=arc-20160816; b=wXnHKGwlVO839EGuuiasH2cjH1NdZz/bi+qFuoHdU3zBf65uIbGb3b5rcqwYFCZNee 1db0yGR2stzpyJ1f8znM48PS0yq+PCz28VTgDjFenOXyXJzhFXo14QjaG7dTPe/SjwL2 k0DjoW51vIZQHhO1HFk1i7Ey9Aym24vl/SJcmnSRjcIF5ZC9ndBcbrLM9OvAsctbRHL6 QWIxU+oJvd40u8+kVA5DYuts6RxXpsuqzqBSZj7zPUQ9mlcevRdOIlyeiks51Kqh2Lm6 Go3JonEztvV65fQhsckDf7DYi2NGCJ/kz3sTrP/oHHORD0MbjX+y2JXlLabTSZxHCd/L tfxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=dPU5rDbRXNZR3mGxrVtgTT7qKCNIJzL3wX4Y2kmnrAI=; b=wBtKRPUZD4uzzMW4Js7mLvbLCOVzkFa/4p+6hDc+EgbQDZSnnYf6m+U1ZTIc4RV/Aq yQkrYCtGQNeHDp1P0/F4jtdy32JyG6WrevqE/rEmhJnUQX75WEmj5NocDWdA5AwT3ZrX tFkQXSxq4PzpB0EY7HtrvT88rFpQMQbkfsA1gQajX1KSJQK4W/SxLJ/KqH7WDnJlGG9k kbDjIxMCfou/dYluE1OKPwIWzn/VSQvZUAcsluJHh+PdwKwIC8cXNuWRU76nakrUiX+q QYxklEiugupE1ZLYaDC6AZJiTXXwTdhqWdUW1cBGXxLBKLSRQT4Jaz+Q1zd66u4zOmVc bO8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PnH4HwG4; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-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 r67si4467953oib.237.2020.04.03.16.20.29; Fri, 03 Apr 2020 16:20:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-bluetooth-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=PnH4HwG4; spf=pass (google.com: best guess record for domain of linux-bluetooth-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-bluetooth-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 S1728288AbgDCXTF (ORCPT + 99 others); Fri, 3 Apr 2020 19:19:05 -0400 Received: from mail-il1-f195.google.com ([209.85.166.195]:36974 "EHLO mail-il1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727958AbgDCXTF (ORCPT ); Fri, 3 Apr 2020 19:19:05 -0400 Received: by mail-il1-f195.google.com with SMTP id a6so9090915ilr.4; Fri, 03 Apr 2020 16:19:04 -0700 (PDT) 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:content-transfer-encoding; bh=dPU5rDbRXNZR3mGxrVtgTT7qKCNIJzL3wX4Y2kmnrAI=; b=PnH4HwG48u1Ut+Ivho3hvvqb5bhaAn4hSi8EHYGucTzs1wkC3b4hv1g19ShqB9AOhX URcN/2rsL80NiwAX3sTZFmaeuvHiVq+d5ouj5aV6lBlZ7SuAG4GGoaKg6dp4hL1tqiQr VdyMqjf0lOFut5bLlrm/v8h3QdrXjW/N9csK77csL48LcAj6JKr/GptmX9+9rgj7FQ3T Mw58AU2tiMh7G56Pq7HU4egpWgB4YyFIcZNoBEClZfga29RMkKiCNOdajMHsheKPfEZ5 9t5bvKmj/oq9x3AwpXm5ysdVgBEUwxYsgg6fZ9xrf9S06kevIdf2Mv1KO5kfaByVFZI4 fNhA== 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:content-transfer-encoding; bh=dPU5rDbRXNZR3mGxrVtgTT7qKCNIJzL3wX4Y2kmnrAI=; b=FbooZicPc+RoVA6ckCkh1Bhjj7q9HSPrdDoa92x2idgKAei4tBOFMCBBFU1w47OZMR 4rTaQwV2+7typtiVkeC5X2+1k50lwF8Fe5JccR1+7HLe6GYF2FzgJvng3ZBCo3tNmBI5 5KfXyzaE/T1445YAPpSwr6hK9cOxsnxzEWaz+xtA5/uwnh2nZ4pe8qJj4np5aylN5HUi 5xwewXn3F+82tLfERvpraQIu8MJ5YbUdsIO4LglNE+oCDMMjS+cMTAQ6Jw94Db05k4LJ F39ZXeVzAhxJ0n7QfTUS8alVZG3lVwwm61n88To8+BbGAZArikOt8qnbtRgl50Ckb9b7 4y2A== X-Gm-Message-State: AGi0PuZMWLmtbV0CYzFnUpSlMIv+cqCvvviS5SbE7CePpyZZVuPfumMN WHJZXLlJLTVOo/osAFRibMx/AJptwQo8gmkN1y0= X-Received: by 2002:a92:cf52:: with SMTP id c18mr10652807ilr.246.1585955944184; Fri, 03 Apr 2020 16:19:04 -0700 (PDT) MIME-Version: 1.0 References: <20200323194507.90944-1-abhishekpandit@chromium.org> <20200323124503.v3.1.I17e2220fd0c0822c76a15ef89b882fb4cfe3fe89@changeid> <7FD50BDC-A4B5-4ED9-8DAB-887039735800@holtmann.org> In-Reply-To: From: Dave Taht Date: Fri, 3 Apr 2020 16:18:53 -0700 Message-ID: Subject: Re: [PATCH v3 1/1] Bluetooth: Prioritize SCO traffic To: Abhishek Pandit-Subedi Cc: Marcel Holtmann , Bluetooth Kernel Mailing List , ChromeOS Bluetooth Upstreaming , "David S. Miller" , Johan Hedberg , netdev , LKML , Jakub Kicinski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-bluetooth-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org On Fri, Apr 3, 2020 at 11:11 AM Abhishek Pandit-Subedi wrote: > > Hi Marcel, > > Thanks for merging. > > I agree that the distinction between SCO/eSCO and ACL/LE is a bit > concerning for scheduling. I will make some time to revisit this as > part of Audio improvements we are making. A) I know nothing of bluetooth. B) I am unfond of strict priority queues, as they can cause starvation. My immediate instinct is to reach for a drr++ derived solution to give fairness to all flows, and a bit of priority to the ones that matter most. > > Thanks > Abhishek > > Abhishek > > On Thu, Apr 2, 2020 at 11:56 PM Marcel Holtmann wro= te: > > > > Hi Abhishek, > > > > > When scheduling TX packets, send all SCO/eSCO packets first, check fo= r > > > pending SCO/eSCO packets after every ACL/LE packet and send them if a= ny > > > are pending. This is done to make sure that we can meet SCO deadline= s > > > on slow interfaces like UART. > > > > > > If we were to queue up multiple ACL packets without checking for a SC= O > > > packet, we might miss the SCO timing. For example: > > > > > > The time it takes to send a maximum size ACL packet (1024 bytes): > > > t =3D 10/8 * 1024 bytes * 8 bits/byte * 1 packet / baudrate > > > where 10/8 is uart overhead due to start/stop bits per byte > > > > > > Replace t =3D 3.75ms (SCO deadline), which gives us a baudrate of 273= 0666. > > > > > > At a baudrate of 3000000, if we didn't check for SCO packets within 1= 024 > > > bytes, we would miss the 3.75ms timing window. > > > > > > Signed-off-by: Abhishek Pandit-Subedi > > > --- > > > > > > Changes in v3: > > > * Removed hci_sched_sync > > > > > > Changes in v2: > > > * Refactor to check for SCO/eSCO after each ACL/LE packet sent > > > * Enabled SCO priority all the time and removed the sched_limit varia= ble > > > > > > net/bluetooth/hci_core.c | 106 +++++++++++++++++++++-----------------= - > > > 1 file changed, 57 insertions(+), 49 deletions(-) > > > > patch has been applied to bluetooth-next tree. > > > > However I have been a bit reluctant to apply this right away. I think w= hen this code was originally written, we only had ACL and SCO packets. The = world was pretty simple. And right now we also only have two packets types = (ignoring ISO packets for now), but we added LE and eSCO as separate schedu= ling and thus =E2=80=9Cfake=E2=80=9D packet types. > > > > I have the feeling that this serialized packet processing will get us i= nto trouble since we prioritize BR/EDR packets over LE packets and SCO over= eSCO. I think we should have looked at all packets based on SO_PRIORITY an= d with ISO packets we have to most likely re-design this. Anyway, just some= thing to think about. > > > > Regards > > > > Marcel > > --=20 Make Music, Not War Dave T=C3=A4ht CTO, TekLibre, LLC http://www.teklibre.com Tel: 1-831-435-0729