* [PATCH 10/10] sound: ua101: convert tasklets to use new tasklet_setup() API
From: Allen Pais @ 2020-08-17 8:57 UTC (permalink / raw)
To: perex, tiwai, clemens, o-takashi, timur, nicoleotsuka, Xiubo.Lee
Cc: alsa-devel, keescook, Allen Pais, linux-kernel, Romain Perier,
linuxppc-dev
In-Reply-To: <20200817085703.25732-1-allen.cryptic@gmail.com>
From: Allen Pais <allen.lkml@gmail.com>
In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.
Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
sound/usb/misc/ua101.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/sound/usb/misc/ua101.c b/sound/usb/misc/ua101.c
index 884e740a785c..3b2dce1043f5 100644
--- a/sound/usb/misc/ua101.c
+++ b/sound/usb/misc/ua101.c
@@ -247,9 +247,9 @@ static inline void add_with_wraparound(struct ua101 *ua,
*value -= ua->playback.queue_length;
}
-static void playback_tasklet(unsigned long data)
+static void playback_tasklet(struct tasklet_struct *t)
{
- struct ua101 *ua = (void *)data;
+ struct ua101 *ua = from_tasklet(ua, t, playback_tasklet);
unsigned long flags;
unsigned int frames;
struct ua101_urb *urb;
@@ -1218,8 +1218,7 @@ static int ua101_probe(struct usb_interface *interface,
spin_lock_init(&ua->lock);
mutex_init(&ua->mutex);
INIT_LIST_HEAD(&ua->ready_playback_urbs);
- tasklet_init(&ua->playback_tasklet,
- playback_tasklet, (unsigned long)ua);
+ tasklet_setup(&ua->playback_tasklet, playback_tasklet);
init_waitqueue_head(&ua->alsa_capture_wait);
init_waitqueue_head(&ua->rate_feedback_wait);
init_waitqueue_head(&ua->alsa_playback_wait);
--
2.17.1
^ permalink raw reply related
* [PATCH 0/7] usb: convert tasklets to use new tasklet_setup()
From: Allen Pais @ 2020-08-17 9:02 UTC (permalink / raw)
To: duncan.sands, gregkh, jacmet, balbi, leoyang.li, johan
Cc: linux-usb, linuxppc-dev, keescook, Allen Pais, linux-kernel
From: Allen Pais <allen.lkml@gmail.com>
Commit 12cc923f1ccc ("tasklet: Introduce new initialization API")'
introduced a new tasklet initialization API. This series converts
all the usb drivers to use the new tasklet_setup() API
Allen Pais (7):
usb: atm: convert tasklets to use new tasklet_setup() API
usb: c67x00: convert tasklets to use new tasklet_setup() API
usb: hcd: convert tasklets to use new tasklet_setup() API
usb/gadget: f_midi: convert tasklets to use new tasklet_setup() API
usb/gadget: fsl_qe_udc: convert tasklets to use new tasklet_setup()
API
usb: xhci: convert tasklets to use new tasklet_setup() API
usb: mos7720: convert tasklets to use new tasklet_setup() API
drivers/usb/atm/usbatm.c | 14 ++++++++------
drivers/usb/c67x00/c67x00-sched.c | 7 +++----
drivers/usb/core/hcd.c | 6 +++---
drivers/usb/gadget/function/f_midi.c | 6 +++---
drivers/usb/gadget/udc/fsl_qe_udc.c | 7 +++----
drivers/usb/host/xhci-dbgtty.c | 6 +++---
drivers/usb/serial/mos7720.c | 8 ++++----
7 files changed, 27 insertions(+), 27 deletions(-)
--
2.17.1
^ permalink raw reply
* [PATCH 1/7] usb: atm: convert tasklets to use new tasklet_setup() API
From: Allen Pais @ 2020-08-17 9:02 UTC (permalink / raw)
To: duncan.sands, gregkh, jacmet, balbi, leoyang.li, johan
Cc: keescook, linux-usb, Allen Pais, linux-kernel, Romain Perier,
linuxppc-dev
In-Reply-To: <20200817090209.26351-1-allen.cryptic@gmail.com>
From: Allen Pais <allen.lkml@gmail.com>
In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.
Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
drivers/usb/atm/usbatm.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/usb/atm/usbatm.c b/drivers/usb/atm/usbatm.c
index 4e12a32ca392..56fe30d247da 100644
--- a/drivers/usb/atm/usbatm.c
+++ b/drivers/usb/atm/usbatm.c
@@ -511,9 +511,10 @@ static unsigned int usbatm_write_cells(struct usbatm_data *instance,
** receive **
**************/
-static void usbatm_rx_process(unsigned long data)
+static void usbatm_rx_process(struct tasklet_struct *t)
{
- struct usbatm_data *instance = (struct usbatm_data *)data;
+ struct usbatm_data *instance = from_tasklet(instance, t,
+ rx_channel.tasklet);
struct urb *urb;
while ((urb = usbatm_pop_urb(&instance->rx_channel))) {
@@ -564,9 +565,10 @@ static void usbatm_rx_process(unsigned long data)
** send **
***********/
-static void usbatm_tx_process(unsigned long data)
+static void usbatm_tx_process(struct tasklet_struct *t)
{
- struct usbatm_data *instance = (struct usbatm_data *)data;
+ struct usbatm_data *instance = from_tasklet(instance, t,
+ tx_channel.tasklet);
struct sk_buff *skb = instance->current_skb;
struct urb *urb = NULL;
const unsigned int buf_size = instance->tx_channel.buf_size;
@@ -1069,8 +1071,8 @@ int usbatm_usb_probe(struct usb_interface *intf, const struct usb_device_id *id,
usbatm_init_channel(&instance->rx_channel);
usbatm_init_channel(&instance->tx_channel);
- tasklet_init(&instance->rx_channel.tasklet, usbatm_rx_process, (unsigned long)instance);
- tasklet_init(&instance->tx_channel.tasklet, usbatm_tx_process, (unsigned long)instance);
+ tasklet_setup(&instance->rx_channel.tasklet, usbatm_rx_process);
+ tasklet_setup(&instance->tx_channel.tasklet, usbatm_tx_process);
instance->rx_channel.stride = ATM_CELL_SIZE + driver->rx_padding;
instance->tx_channel.stride = ATM_CELL_SIZE + driver->tx_padding;
instance->rx_channel.usbatm = instance->tx_channel.usbatm = instance;
--
2.17.1
^ permalink raw reply related
* [PATCH 2/7] usb: c67x00: convert tasklets to use new tasklet_setup() API
From: Allen Pais @ 2020-08-17 9:02 UTC (permalink / raw)
To: duncan.sands, gregkh, jacmet, balbi, leoyang.li, johan
Cc: keescook, linux-usb, Allen Pais, linux-kernel, Romain Perier,
linuxppc-dev
In-Reply-To: <20200817090209.26351-1-allen.cryptic@gmail.com>
From: Allen Pais <allen.lkml@gmail.com>
In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.
Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
drivers/usb/c67x00/c67x00-sched.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/c67x00/c67x00-sched.c b/drivers/usb/c67x00/c67x00-sched.c
index f7f6229082ca..6275cb77a15b 100644
--- a/drivers/usb/c67x00/c67x00-sched.c
+++ b/drivers/usb/c67x00/c67x00-sched.c
@@ -1122,9 +1122,9 @@ static void c67x00_do_work(struct c67x00_hcd *c67x00)
/* -------------------------------------------------------------------------- */
-static void c67x00_sched_tasklet(unsigned long __c67x00)
+static void c67x00_sched_tasklet(struct tasklet_struct *t)
{
- struct c67x00_hcd *c67x00 = (struct c67x00_hcd *)__c67x00;
+ struct c67x00_hcd *c67x00 = from_tasklet(c67x00, t, tasklet);
c67x00_do_work(c67x00);
}
@@ -1135,8 +1135,7 @@ void c67x00_sched_kick(struct c67x00_hcd *c67x00)
int c67x00_sched_start_scheduler(struct c67x00_hcd *c67x00)
{
- tasklet_init(&c67x00->tasklet, c67x00_sched_tasklet,
- (unsigned long)c67x00);
+ tasklet_setup(&c67x00->tasklet, c67x00_sched_tasklet);
return 0;
}
--
2.17.1
^ permalink raw reply related
* [PATCH 3/7] usb: hcd: convert tasklets to use new tasklet_setup() API
From: Allen Pais @ 2020-08-17 9:02 UTC (permalink / raw)
To: duncan.sands, gregkh, jacmet, balbi, leoyang.li, johan
Cc: keescook, linux-usb, Allen Pais, linux-kernel, Romain Perier,
linuxppc-dev
In-Reply-To: <20200817090209.26351-1-allen.cryptic@gmail.com>
From: Allen Pais <allen.lkml@gmail.com>
In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.
Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
drivers/usb/core/hcd.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index a33b849e8beb..2c6b9578a7d3 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -1657,9 +1657,9 @@ static void __usb_hcd_giveback_urb(struct urb *urb)
usb_put_urb(urb);
}
-static void usb_giveback_urb_bh(unsigned long param)
+static void usb_giveback_urb_bh(struct tasklet_struct *t)
{
- struct giveback_urb_bh *bh = (struct giveback_urb_bh *)param;
+ struct giveback_urb_bh *bh = from_tasklet(bh, t, bh);
struct list_head local_list;
spin_lock_irq(&bh->lock);
@@ -2403,7 +2403,7 @@ static void init_giveback_urb_bh(struct giveback_urb_bh *bh)
spin_lock_init(&bh->lock);
INIT_LIST_HEAD(&bh->head);
- tasklet_init(&bh->bh, usb_giveback_urb_bh, (unsigned long)bh);
+ tasklet_setup(&bh->bh, usb_giveback_urb_bh);
}
struct usb_hcd *__usb_create_hcd(const struct hc_driver *driver,
--
2.17.1
^ permalink raw reply related
* [PATCH 4/7] usb/gadget: f_midi: convert tasklets to use new tasklet_setup() API
From: Allen Pais @ 2020-08-17 9:02 UTC (permalink / raw)
To: duncan.sands, gregkh, jacmet, balbi, leoyang.li, johan
Cc: keescook, linux-usb, Allen Pais, linux-kernel, Romain Perier,
linuxppc-dev
In-Reply-To: <20200817090209.26351-1-allen.cryptic@gmail.com>
From: Allen Pais <allen.lkml@gmail.com>
In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.
Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
drivers/usb/gadget/function/f_midi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/gadget/function/f_midi.c b/drivers/usb/gadget/function/f_midi.c
index 46af0aa07e2e..85cb15734aa8 100644
--- a/drivers/usb/gadget/function/f_midi.c
+++ b/drivers/usb/gadget/function/f_midi.c
@@ -698,9 +698,9 @@ static void f_midi_transmit(struct f_midi *midi)
f_midi_drop_out_substreams(midi);
}
-static void f_midi_in_tasklet(unsigned long data)
+static void f_midi_in_tasklet(struct tasklet_struct *t)
{
- struct f_midi *midi = (struct f_midi *) data;
+ struct f_midi *midi = from_tasklet(midi, t, tasklet);
f_midi_transmit(midi);
}
@@ -875,7 +875,7 @@ static int f_midi_bind(struct usb_configuration *c, struct usb_function *f)
int status, n, jack = 1, i = 0, endpoint_descriptor_index = 0;
midi->gadget = cdev->gadget;
- tasklet_init(&midi->tasklet, f_midi_in_tasklet, (unsigned long) midi);
+ tasklet_setup(&midi->tasklet, f_midi_in_tasklet);
status = f_midi_register_card(midi);
if (status < 0)
goto fail_register;
--
2.17.1
^ permalink raw reply related
* [PATCH 5/7] usb/gadget: fsl_qe_udc: convert tasklets to use new tasklet_setup() API
From: Allen Pais @ 2020-08-17 9:02 UTC (permalink / raw)
To: duncan.sands, gregkh, jacmet, balbi, leoyang.li, johan
Cc: keescook, linux-usb, Allen Pais, linux-kernel, Romain Perier,
linuxppc-dev
In-Reply-To: <20200817090209.26351-1-allen.cryptic@gmail.com>
From: Allen Pais <allen.lkml@gmail.com>
In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.
Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
drivers/usb/gadget/udc/fsl_qe_udc.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/gadget/udc/fsl_qe_udc.c b/drivers/usb/gadget/udc/fsl_qe_udc.c
index 2707be628298..fa66449b3907 100644
--- a/drivers/usb/gadget/udc/fsl_qe_udc.c
+++ b/drivers/usb/gadget/udc/fsl_qe_udc.c
@@ -923,9 +923,9 @@ static int qe_ep_rxframe_handle(struct qe_ep *ep)
return 0;
}
-static void ep_rx_tasklet(unsigned long data)
+static void ep_rx_tasklet(struct tasklet_struct *t)
{
- struct qe_udc *udc = (struct qe_udc *)data;
+ struct qe_udc *udc = from_tasklet(udc, t, rx_tasklet);
struct qe_ep *ep;
struct qe_frame *pframe;
struct qe_bd __iomem *bd;
@@ -2553,8 +2553,7 @@ static int qe_udc_probe(struct platform_device *ofdev)
DMA_TO_DEVICE);
}
- tasklet_init(&udc->rx_tasklet, ep_rx_tasklet,
- (unsigned long)udc);
+ tasklet_setup(&udc->rx_tasklet, ep_rx_tasklet);
/* request irq and disable DR */
udc->usb_irq = irq_of_parse_and_map(np, 0);
if (!udc->usb_irq) {
--
2.17.1
^ permalink raw reply related
* [PATCH 6/7] usb: xhci: convert tasklets to use new tasklet_setup() API
From: Allen Pais @ 2020-08-17 9:02 UTC (permalink / raw)
To: duncan.sands, gregkh, jacmet, balbi, leoyang.li, johan
Cc: keescook, linux-usb, Allen Pais, linux-kernel, Romain Perier,
linuxppc-dev
In-Reply-To: <20200817090209.26351-1-allen.cryptic@gmail.com>
From: Allen Pais <allen.lkml@gmail.com>
In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.
Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
drivers/usb/host/xhci-dbgtty.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/xhci-dbgtty.c b/drivers/usb/host/xhci-dbgtty.c
index b8918f73a432..ae4e4ab638b5 100644
--- a/drivers/usb/host/xhci-dbgtty.c
+++ b/drivers/usb/host/xhci-dbgtty.c
@@ -288,14 +288,14 @@ static const struct tty_operations dbc_tty_ops = {
.unthrottle = dbc_tty_unthrottle,
};
-static void dbc_rx_push(unsigned long _port)
+static void dbc_rx_push(struct tasklet_struct *t)
{
struct dbc_request *req;
struct tty_struct *tty;
unsigned long flags;
bool do_push = false;
bool disconnect = false;
- struct dbc_port *port = (void *)_port;
+ struct dbc_port *port = from_tasklet(port, t, push);
struct list_head *queue = &port->read_queue;
spin_lock_irqsave(&port->port_lock, flags);
@@ -382,7 +382,7 @@ xhci_dbc_tty_init_port(struct xhci_dbc *dbc, struct dbc_port *port)
{
tty_port_init(&port->port);
spin_lock_init(&port->port_lock);
- tasklet_init(&port->push, dbc_rx_push, (unsigned long)port);
+ tasklet_setup(&port->push, dbc_rx_push);
INIT_LIST_HEAD(&port->read_pool);
INIT_LIST_HEAD(&port->read_queue);
INIT_LIST_HEAD(&port->write_pool);
--
2.17.1
^ permalink raw reply related
* [PATCH 7/7] usb: mos7720: convert tasklets to use new tasklet_setup() API
From: Allen Pais @ 2020-08-17 9:02 UTC (permalink / raw)
To: duncan.sands, gregkh, jacmet, balbi, leoyang.li, johan
Cc: keescook, linux-usb, Allen Pais, linux-kernel, Romain Perier,
linuxppc-dev
In-Reply-To: <20200817090209.26351-1-allen.cryptic@gmail.com>
From: Allen Pais <allen.lkml@gmail.com>
In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.
Signed-off-by: Romain Perier <romain.perier@gmail.com>
Signed-off-by: Allen Pais <allen.lkml@gmail.com>
---
drivers/usb/serial/mos7720.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c
index 2ec4eeacebc7..5eed1078fac8 100644
--- a/drivers/usb/serial/mos7720.c
+++ b/drivers/usb/serial/mos7720.c
@@ -282,11 +282,12 @@ static void destroy_urbtracker(struct kref *kref)
* port callback had to be deferred because the disconnect mutex could not be
* obtained at the time.
*/
-static void send_deferred_urbs(unsigned long _mos_parport)
+static void send_deferred_urbs(struct tasklet_struct *t)
{
int ret_val;
unsigned long flags;
- struct mos7715_parport *mos_parport = (void *)_mos_parport;
+ struct mos7715_parport *mos_parport = from_tasklet(mos_parport, t,
+ urb_tasklet);
struct urbtracker *urbtrack, *tmp;
struct list_head *cursor, *next;
struct device *dev;
@@ -716,8 +717,7 @@ static int mos7715_parport_init(struct usb_serial *serial)
INIT_LIST_HEAD(&mos_parport->deferred_urbs);
usb_set_serial_data(serial, mos_parport); /* hijack private pointer */
mos_parport->serial = serial;
- tasklet_init(&mos_parport->urb_tasklet, send_deferred_urbs,
- (unsigned long) mos_parport);
+ tasklet_setup(&mos_parport->urb_tasklet, send_deferred_urbs);
init_completion(&mos_parport->syncmsg_compl);
/* cycle parallel port reset bit */
--
2.17.1
^ permalink raw reply related
* Re: [PATCH 00/10] sound: convert tasklets to use new tasklet_setup()
From: Allen Pais @ 2020-08-17 9:18 UTC (permalink / raw)
To: Takashi Iwai
Cc: alsa-devel, keescook, timur, Xiubo.Lee, linux-kernel, clemens,
tiwai, o-takashi, nicoleotsuka, Allen Pais, perex, linuxppc-dev
In-Reply-To: <s5hpn7pprl1.wl-tiwai@suse.de>
>
> Is this targeted for 5.9 or 5.10?
This is targeted for 5.9.
> I have a patch set to drop the whole tasklet usage in sound/*
> (destined for 5.10, to be submitted soon), so if that's for 5.10,
> it'll be likely superfluous.
I have picked patches from your tree to adapt to this new API.
Those can be picked in 5.10 I suppose.
Thanks.
^ permalink raw reply
* Re: [PATCH v2 1/3] powerpc/numa: Introduce logical numa id
From: Aneesh Kumar K.V @ 2020-08-17 11:34 UTC (permalink / raw)
To: Srikar Dronamraju; +Cc: Nathan Lynch, linuxppc-dev
In-Reply-To: <20200817105950.GA31352@linux.vnet.ibm.com>
On 8/17/20 4:29 PM, Srikar Dronamraju wrote:
> * Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> [2020-08-17 16:02:36]:
>
>> We use ibm,associativity and ibm,associativity-lookup-arrays to derive the numa
>> node numbers. These device tree properties are firmware indicated grouping of
>> resources based on their hierarchy in the platform. These numbers (group id) are
>> not sequential and hypervisor/firmware can follow different numbering schemes.
>> For ex: on powernv platforms, we group them in the below order.
>>
>> * - CCM node ID
>> * - HW card ID
>> * - HW module ID
>> * - Chip ID
>> * - Core ID
>>
>> Based on ibm,associativity-reference-points we use one of the above group ids as
>> Linux NUMA node id. (On PowerNV platform Chip ID is used). This results
>> in Linux reporting non-linear NUMA node id and which also results in Linux
>> reporting empty node 0 NUMA nodes.
>>
>> This can be resolved by mapping the firmware provided group id to a logical Linux
>> NUMA id. In this patch, we do this only for pseries platforms considering the
>> firmware group id is a virtualized entity and users would not have drawn any
>> conclusion based on the Linux Numa Node id.
>>
>> On PowerNV platform since we have historically mapped Chip ID as Linux NUMA node
>> id, we keep the existing Linux NUMA node id numbering.
>
> I still dont understand how you are going to handle numa distances.
> With your patch, have you tried dlpar add/remove on a sparsely noded machine?
>
We follow the same steps when fetching distance information. Instead of
using affinity domain id, we now use the mapped node id. The relevant
hunk in the patch is
+ nid = affinity_domain_to_nid(&domain);
if (nid > 0 &&
- of_read_number(associativity, 1) >= distance_ref_points_depth) {
+ of_read_number(associativity, 1) >= distance_ref_points_depth) {
/*
* Skip the length field and send start of associativity array
*/
I haven't tried dlpar add/remove. I don't have a setup to try that. Do
you see a problem there?
-aneesh
^ permalink raw reply
* Re: [PATCH v2 1/3] powerpc/numa: Introduce logical numa id
From: Srikar Dronamraju @ 2020-08-17 11:49 UTC (permalink / raw)
To: Aneesh Kumar K.V; +Cc: Nathan Lynch, linuxppc-dev
In-Reply-To: <15a2f88d-e609-cce9-a82c-321073b9574b@linux.ibm.com>
* Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> [2020-08-17 17:04:24]:
> On 8/17/20 4:29 PM, Srikar Dronamraju wrote:
> > * Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> [2020-08-17 16:02:36]:
> >
> > > We use ibm,associativity and ibm,associativity-lookup-arrays to derive the numa
> > > node numbers. These device tree properties are firmware indicated grouping of
> > > resources based on their hierarchy in the platform. These numbers (group id) are
> > > not sequential and hypervisor/firmware can follow different numbering schemes.
> > > For ex: on powernv platforms, we group them in the below order.
> > >
> > > * - CCM node ID
> > > * - HW card ID
> > > * - HW module ID
> > > * - Chip ID
> > > * - Core ID
> > >
> > > Based on ibm,associativity-reference-points we use one of the above group ids as
> > > Linux NUMA node id. (On PowerNV platform Chip ID is used). This results
> > > in Linux reporting non-linear NUMA node id and which also results in Linux
> > > reporting empty node 0 NUMA nodes.
> > >
> > > This can be resolved by mapping the firmware provided group id to a logical Linux
> > > NUMA id. In this patch, we do this only for pseries platforms considering the
> > > firmware group id is a virtualized entity and users would not have drawn any
> > > conclusion based on the Linux Numa Node id.
> > >
> > > On PowerNV platform since we have historically mapped Chip ID as Linux NUMA node
> > > id, we keep the existing Linux NUMA node id numbering.
> >
> > I still dont understand how you are going to handle numa distances.
> > With your patch, have you tried dlpar add/remove on a sparsely noded machine?
> >
>
> We follow the same steps when fetching distance information. Instead of
> using affinity domain id, we now use the mapped node id. The relevant hunk
> in the patch is
>
> + nid = affinity_domain_to_nid(&domain);
>
> if (nid > 0 &&
> - of_read_number(associativity, 1) >= distance_ref_points_depth) {
> + of_read_number(associativity, 1) >= distance_ref_points_depth) {
> /*
> * Skip the length field and send start of associativity array
> */
>
> I haven't tried dlpar add/remove. I don't have a setup to try that. Do you
> see a problem there?
>
Yes, I think there can be 2 problems.
1. distance table may be filled with incorrect data.
2. numactl -H distance table shows symmetric data, the symmetric nature may
be lost.
> -aneesh
>
>
--
Thanks and Regards
Srikar Dronamraju
^ permalink raw reply
* Re: [PATCH v2 2/4] powerpc/mem: Store the dt_root_size/addr cell values for later usage
From: Hari Bathini @ 2020-08-17 15:30 UTC (permalink / raw)
To: Aneesh Kumar K.V, linuxppc-dev, mpe; +Cc: Nathan Lynch
In-Reply-To: <20200806162329.276534-2-aneesh.kumar@linux.ibm.com>
On 06/08/20 9:53 pm, Aneesh Kumar K.V wrote:
> dt_root_addr_cells and dt_root_size_cells are __initdata variables.
> So make a copy of the same which can be used post init.
>
This avoids doing the same thing at multiple places.
So, thanks for the patch, Aneesh.
Looks good to me.
but nitpick below...
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> ---
> arch/powerpc/include/asm/drmem.h | 2 ++
> arch/powerpc/kernel/prom.c | 7 +++++++
> arch/powerpc/mm/numa.c | 1 +
> 3 files changed, 10 insertions(+)
>
> diff --git a/arch/powerpc/include/asm/drmem.h b/arch/powerpc/include/asm/drmem.h
> index d719cbac34b2..ffb59caa88ee 100644
> --- a/arch/powerpc/include/asm/drmem.h
> +++ b/arch/powerpc/include/asm/drmem.h
> @@ -123,4 +123,6 @@ static inline void lmb_clear_nid(struct drmem_lmb *lmb)
> }
> #endif
>
> +extern int mem_addr_cells, mem_size_cells;
Should this be in include/asm/prom.h instead, given the definition
comes from kernel/prom.c file?
> +
> #endif /* _ASM_POWERPC_LMB_H */
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index d8a2fb87ba0c..9a1701e85747 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -73,6 +73,7 @@ u64 ppc64_rma_size;
> #endif
> static phys_addr_t first_memblock_size;
> static int __initdata boot_cpu_count;
> +int mem_addr_cells, mem_size_cells;
>
> static int __init early_parse_mem(char *p)
> {
> @@ -536,6 +537,12 @@ static int __init early_init_dt_scan_memory_ppc(unsigned long node,
> const char *uname,
> int depth, void *data)
> {
> + /*
> + * Make a copy from __initdata variable
> + */
> + mem_addr_cells = dt_root_addr_cells;
> + mem_size_cells = dt_root_size_cells;
> +
> #ifdef CONFIG_PPC_PSERIES
> if (depth == 1 &&
> strcmp(uname, "ibm,dynamic-reconfiguration-memory") == 0) {
> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> index 058fee9a0835..77d41d9775d2 100644
> --- a/arch/powerpc/mm/numa.c
> +++ b/arch/powerpc/mm/numa.c
> @@ -368,6 +368,7 @@ static void __init get_n_mem_cells(int *n_addr_cells, int *n_size_cells)
> of_node_put(memory);
> }
>
> +/* dt_mem_next_cell is __init */
> static unsigned long read_n_cells(int n, const __be32 **buf)
> {
> unsigned long result = 0;
>
^ permalink raw reply
* Re: [PATCH 06/20] ethernet: chelsio: convert tasklets to use new tasklet_setup() API
From: Jakub Kicinski @ 2020-08-17 15:32 UTC (permalink / raw)
To: Allen Pais
Cc: jes, borisp, keescook, linux-rdma, netdev, kda, cooldavid,
dougmill, linux-kernel, linux-acenic, oss-drivers, Romain Perier,
linuxppc-dev, davem, linux-arm-kernel, mlindner
In-Reply-To: <20200817082434.21176-8-allen.lkml@gmail.com>
On Mon, 17 Aug 2020 13:54:20 +0530 Allen Pais wrote:
> In preparation for unconditionally passing the
> struct tasklet_struct pointer to all tasklet
> callbacks, switch to using the new tasklet_setup()
> and from_tasklet() to pass the tasklet pointer explicitly.
>
> Signed-off-by: Romain Perier <romain.perier@gmail.com>
> Signed-off-by: Allen Pais <allen.lkml@gmail.com>
You need to adjust kdoc when you change functions:
drivers/net/ethernet/chelsio/cxgb4/sge.c:2664: warning: Function parameter or member 't' not described in 'restart_ctrlq'
drivers/net/ethernet/chelsio/cxgb4/sge.c:2664: warning: Excess function parameter 'data' description in 'restart_ctrlq'
drivers/net/ethernet/chelsio/cxgb4/sge.c:2965: warning: Function parameter or member 't' not described in 'restart_ofldq'
drivers/net/ethernet/chelsio/cxgb4/sge.c:2965: warning: Excess function parameter 'data' description in 'restart_ofldq'
^ permalink raw reply
* Re: [PATCH 08/20] ethernet: hinic: convert tasklets to use new tasklet_setup() API
From: Jakub Kicinski @ 2020-08-17 15:33 UTC (permalink / raw)
To: Allen Pais
Cc: jes, borisp, keescook, linux-rdma, netdev, kda, cooldavid,
dougmill, linux-kernel, linux-acenic, oss-drivers, Romain Perier,
linuxppc-dev, davem, linux-arm-kernel, mlindner
In-Reply-To: <20200817082434.21176-10-allen.lkml@gmail.com>
On Mon, 17 Aug 2020 13:54:22 +0530 Allen Pais wrote:
> In preparation for unconditionally passing the
> struct tasklet_struct pointer to all tasklet
> callbacks, switch to using the new tasklet_setup()
> and from_tasklet() to pass the tasklet pointer explicitly.
>
> Signed-off-by: Romain Perier <romain.perier@gmail.com>
> Signed-off-by: Allen Pais <allen.lkml@gmail.com>
drivers/net/ethernet/huawei/hinic/hinic_hw_eqs.c:374: warning: Function parameter or member 't' not described in 'ceq_tasklet'
drivers/net/ethernet/huawei/hinic/hinic_hw_eqs.c:374: warning: Excess function parameter 'ceq_data' description in 'ceq_tasklet'
^ permalink raw reply
* Re: [PATCH] powerpc/book3s64/radix: Fix boot failure with large amount of guest memory
From: Hari Bathini @ 2020-08-17 15:43 UTC (permalink / raw)
To: Aneesh Kumar K.V, linuxppc-dev, mpe; +Cc: Shirisha Ganta, Sandipan Das, npiggin
In-Reply-To: <20200813162039.608649-1-aneesh.kumar@linux.ibm.com>
On 13/08/20 9:50 pm, Aneesh Kumar K.V wrote:
> If the hypervisor doesn't support hugepages, the kernel ends up allocating a large
> number of page table pages. The early page table allocation was wrongly
> setting the max memblock limit to ppc64_rma_size with radix translation
> which resulted in boot failure as shown below.
>
> Kernel panic - not syncing:
> early_alloc_pgtable: Failed to allocate 16777216 bytes align=0x1000000 nid=-1 from=0x0000000000000000 max_addr=0xffffffffffffffff
> CPU: 0 PID: 0 Comm: swapper Not tainted 5.8.0-24.9-default+ #2
> Call Trace:
> [c0000000016f3d00] [c0000000007c6470] dump_stack+0xc4/0x114 (unreliable)
> [c0000000016f3d40] [c00000000014c78c] panic+0x164/0x418
> [c0000000016f3dd0] [c000000000098890] early_alloc_pgtable+0xe0/0xec
> [c0000000016f3e60] [c0000000010a5440] radix__early_init_mmu+0x360/0x4b4
> [c0000000016f3ef0] [c000000001099bac] early_init_mmu+0x1c/0x3c
> [c0000000016f3f10] [c00000000109a320] early_setup+0x134/0x170
>
> This was because the kernel was checking for the radix feature before we enable the
> feature via mmu_features. This resulted in the kernel using hash restrictions on
> radix.
>
> Rework the early init code such that the kernel boot with memblock restrictions
> as imposed by hash. At that point, the kernel still hasn't finalized the
> translation the kernel will end up using.
>
> We have three different ways of detecting radix.
>
> 1. dt_cpu_ftrs_scan -> used only in case of PowerNV
> 2. ibm,pa-features -> Used when we don't use cpu_dt_ftr_scan
> 3. CAS -> Where we negotiate with hypervisor about the supported translation.
>
> We look at 1 or 2 early in the boot and after that, we look at the CAS vector to
> finalize the translation the kernel will use. We also support a kernel command
> line option (disable_radix) to switch to hash.
>
> Update the memblock limit after mmu_early_init_devtree() if the kernel is going
> to use radix translation. This forces some of the memblock allocations we do before
> mmu_early_init_devtree() to be within the RMA limit.
Minor comments below. Nonetheless...
Reviewed-by: Hari Bathini <hbathini@linux.ibm.com>
>
> Fixes: 2bfd65e45e87 ("powerpc/mm/radix: Add radix callbacks for early init routines")
> Reported-by: Shirisha Ganta <shiganta@in.ibm.com>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> ---
> arch/powerpc/include/asm/book3s/64/mmu.h | 8 +++++---
> arch/powerpc/kernel/prom.c | 6 ++++++
> arch/powerpc/mm/book3s64/radix_pgtable.c | 2 ++
> 3 files changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/book3s/64/mmu.h b/arch/powerpc/include/asm/book3s/64/mmu.h
> index 55442d45c597..4245f99453f5 100644
> --- a/arch/powerpc/include/asm/book3s/64/mmu.h
> +++ b/arch/powerpc/include/asm/book3s/64/mmu.h
> @@ -244,9 +244,11 @@ extern void radix__setup_initial_memory_limit(phys_addr_t first_memblock_base,
> static inline void setup_initial_memory_limit(phys_addr_t first_memblock_base,
> phys_addr_t first_memblock_size)
> {
> - if (early_radix_enabled())
> - return radix__setup_initial_memory_limit(first_memblock_base,
> - first_memblock_size);
> + /*
> + * Hash has more strict restrictions. At this point we don't
> + * know which translations we will pick. Hence got with hash
:s/got with/go with/
> + * restrictions.
> + */
> return hash__setup_initial_memory_limit(first_memblock_base,
> first_memblock_size);
> }
> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
> index d8a2fb87ba0c..340900ae95a4 100644
> --- a/arch/powerpc/kernel/prom.c
> +++ b/arch/powerpc/kernel/prom.c
> @@ -811,6 +811,12 @@ void __init early_init_devtree(void *params)
>
> mmu_early_init_devtree();
>
> + /*
> + * Reset ppc64_rma_size and memblock memory limit
> + */
> + if (early_radix_enabled())
> + radix__setup_initial_memory_limit(memstart_addr, first_memblock_size);
> +
> #ifdef CONFIG_PPC_POWERNV
> /* Scan and build the list of machine check recoverable ranges */
> of_scan_flat_dt(early_init_dt_scan_recoverable_ranges, NULL);
> diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c b/arch/powerpc/mm/book3s64/radix_pgtable.c
> index 28c784976bed..094daf16acac 100644
> --- a/arch/powerpc/mm/book3s64/radix_pgtable.c
> +++ b/arch/powerpc/mm/book3s64/radix_pgtable.c
> @@ -747,6 +747,8 @@ void radix__setup_initial_memory_limit(phys_addr_t first_memblock_base,
> * Radix mode is not limited by RMA / VRMA addressing.
> */
> ppc64_rma_size = ULONG_MAX;
> +
> + memblock_set_current_limit(MEMBLOCK_ALLOC_ANYWHERE);
Probably the same thing but I would prefer the below instead:
memblock_set_current_limit(ppc64_rma_size);
Thanks
Hari
^ permalink raw reply
* Re: [PATCH 10/11] powerpc: use non-set_fs based maccess routines
From: Christophe Leroy @ 2020-08-17 15:47 UTC (permalink / raw)
To: Christoph Hellwig, Al Viro, Michael Ellerman, x86
Cc: linux-fsdevel, linux-arch, linuxppc-dev, Kees Cook, linux-kernel
In-Reply-To: <20200817073212.830069-11-hch@lst.de>
Le 17/08/2020 à 09:32, Christoph Hellwig a écrit :
> Provide __get_kernel_nofault and __put_kernel_nofault routines to
> implement the maccess routines without messing with set_fs and without
> opening up access to user space.
__get_user_size() opens access to user space. You have to use
__get_user_size_allowed() when user access is already allowed (or when
not needed to allow it).
Christophe
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
> arch/powerpc/include/asm/uaccess.h | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/arch/powerpc/include/asm/uaccess.h b/arch/powerpc/include/asm/uaccess.h
> index 00699903f1efca..a31de40ac00b62 100644
> --- a/arch/powerpc/include/asm/uaccess.h
> +++ b/arch/powerpc/include/asm/uaccess.h
> @@ -623,4 +623,20 @@ do { \
> __put_user_goto(*(u8*)(_src + _i), (u8 __user *)(_dst + _i), e);\
> } while (0)
>
> +#define HAVE_GET_KERNEL_NOFAULT
> +
> +#define __get_kernel_nofault(dst, src, type, err_label) \
> +do { \
> + int __kr_err; \
> + \
> + __get_user_size(*((type *)(dst)), (__force type __user *)(src), \
> + sizeof(type), __kr_err); \
> + if (unlikely(__kr_err)) \
> + goto err_label; \
> +} while (0)
> +
> +#define __put_kernel_nofault(dst, src, type, err_label) \
> + __put_user_size_goto(*((type *)(src)), \
> + (__force type __user *)(dst), sizeof(type), err_label)
> +
> #endif /* _ARCH_POWERPC_UACCESS_H */
>
^ permalink raw reply
* Re: [PATCH v2 2/4] powerpc/mem: Store the dt_root_size/addr cell values for later usage
From: Aneesh Kumar K.V @ 2020-08-17 15:56 UTC (permalink / raw)
To: Hari Bathini, linuxppc-dev, mpe; +Cc: Nathan Lynch
In-Reply-To: <f0c90b3b-5192-de01-c18c-0c69e895237f@linux.ibm.com>
On 8/17/20 9:00 PM, Hari Bathini wrote:
>
>
> On 06/08/20 9:53 pm, Aneesh Kumar K.V wrote:
>> dt_root_addr_cells and dt_root_size_cells are __initdata variables.
>> So make a copy of the same which can be used post init.
>>
>
> This avoids doing the same thing at multiple places.
> So, thanks for the patch, Aneesh.
>
> Looks good to me.
>
> but nitpick below...
>
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>> ---
>> arch/powerpc/include/asm/drmem.h | 2 ++
>> arch/powerpc/kernel/prom.c | 7 +++++++
>> arch/powerpc/mm/numa.c | 1 +
>> 3 files changed, 10 insertions(+)
>>
>> diff --git a/arch/powerpc/include/asm/drmem.h
>> b/arch/powerpc/include/asm/drmem.h
>> index d719cbac34b2..ffb59caa88ee 100644
>> --- a/arch/powerpc/include/asm/drmem.h
>> +++ b/arch/powerpc/include/asm/drmem.h
>> @@ -123,4 +123,6 @@ static inline void lmb_clear_nid(struct drmem_lmb
>> *lmb)
>> }
>> #endif
>> +extern int mem_addr_cells, mem_size_cells;
>
> Should this be in include/asm/prom.h instead, given the definition
> comes from kernel/prom.c file?
>
We added the variable definition to prom.c because that is where we are
doing early device tree scanning. But the users should not really be
including prom.h. The variables are related drmem and hence I used
drmem.h for include.
>> +
>> #endif /* _ASM_POWERPC_LMB_H */
>> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
>> index d8a2fb87ba0c..9a1701e85747 100644
>> --- a/arch/powerpc/kernel/prom.c
>> +++ b/arch/powerpc/kernel/prom.c
>> @@ -73,6 +73,7 @@ u64 ppc64_rma_size;
>> #endif
>> static phys_addr_t first_memblock_size;
>> static int __initdata boot_cpu_count;
>> +int mem_addr_cells, mem_size_cells;
>> static int __init early_parse_mem(char *p)
>> {
>> @@ -536,6 +537,12 @@ static int __init
>> early_init_dt_scan_memory_ppc(unsigned long node,
>> const char *uname,
>> int depth, void *data)
>> {
>> + /*
>> + * Make a copy from __initdata variable
>> + */
>> + mem_addr_cells = dt_root_addr_cells;
>> + mem_size_cells = dt_root_size_cells;
>> +
>> #ifdef CONFIG_PPC_PSERIES
>> if (depth == 1 &&
>> strcmp(uname, "ibm,dynamic-reconfiguration-memory") == 0) {
>> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
>> index 058fee9a0835..77d41d9775d2 100644
>> --- a/arch/powerpc/mm/numa.c
>> +++ b/arch/powerpc/mm/numa.c
>> @@ -368,6 +368,7 @@ static void __init get_n_mem_cells(int
>> *n_addr_cells, int *n_size_cells)
>> of_node_put(memory);
>> }
>> +/* dt_mem_next_cell is __init */
>> static unsigned long read_n_cells(int n, const __be32 **buf)
>> {
>> unsigned long result = 0;
>>
^ permalink raw reply
* Re: [PATCH] powerpc/book3s64/radix: Fix boot failure with large amount of guest memory
From: Aneesh Kumar K.V @ 2020-08-17 15:58 UTC (permalink / raw)
To: Hari Bathini, linuxppc-dev, mpe; +Cc: Shirisha Ganta, Sandipan Das, npiggin
In-Reply-To: <87c4ab91-b0a0-bd79-40fd-df93aedd98f3@linux.ibm.com>
On 8/17/20 9:13 PM, Hari Bathini wrote:
>
>
> On 13/08/20 9:50 pm, Aneesh Kumar K.V wrote:
>> If the hypervisor doesn't support hugepages, the kernel ends up
>> allocating a large
>> number of page table pages. The early page table allocation was wrongly
>> setting the max memblock limit to ppc64_rma_size with radix translation
>> which resulted in boot failure as shown below.
>>
>> Kernel panic - not syncing:
>> early_alloc_pgtable: Failed to allocate 16777216 bytes align=0x1000000
>> nid=-1 from=0x0000000000000000 max_addr=0xffffffffffffffff
>> CPU: 0 PID: 0 Comm: swapper Not tainted 5.8.0-24.9-default+ #2
>> Call Trace:
>> [c0000000016f3d00] [c0000000007c6470] dump_stack+0xc4/0x114
>> (unreliable)
>> [c0000000016f3d40] [c00000000014c78c] panic+0x164/0x418
>> [c0000000016f3dd0] [c000000000098890] early_alloc_pgtable+0xe0/0xec
>> [c0000000016f3e60] [c0000000010a5440] radix__early_init_mmu+0x360/0x4b4
>> [c0000000016f3ef0] [c000000001099bac] early_init_mmu+0x1c/0x3c
>> [c0000000016f3f10] [c00000000109a320] early_setup+0x134/0x170
>>
>> This was because the kernel was checking for the radix feature before
>> we enable the
>> feature via mmu_features. This resulted in the kernel using hash
>> restrictions on
>> radix.
>>
>> Rework the early init code such that the kernel boot with memblock
>> restrictions
>> as imposed by hash. At that point, the kernel still hasn't finalized the
>> translation the kernel will end up using.
>>
>> We have three different ways of detecting radix.
>>
>> 1. dt_cpu_ftrs_scan -> used only in case of PowerNV
>> 2. ibm,pa-features -> Used when we don't use cpu_dt_ftr_scan
>> 3. CAS -> Where we negotiate with hypervisor about the supported
>> translation.
>>
>> We look at 1 or 2 early in the boot and after that, we look at the CAS
>> vector to
>> finalize the translation the kernel will use. We also support a kernel
>> command
>> line option (disable_radix) to switch to hash.
>>
>> Update the memblock limit after mmu_early_init_devtree() if the kernel
>> is going
>> to use radix translation. This forces some of the memblock allocations
>> we do before
>> mmu_early_init_devtree() to be within the RMA limit.
>
> Minor comments below. Nonetheless...
>
> Reviewed-by: Hari Bathini <hbathini@linux.ibm.com>
>
>>
>> Fixes: 2bfd65e45e87 ("powerpc/mm/radix: Add radix callbacks for early
>> init routines")
>> Reported-by: Shirisha Ganta <shiganta@in.ibm.com>
>> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
>> ---
>> arch/powerpc/include/asm/book3s/64/mmu.h | 8 +++++---
>> arch/powerpc/kernel/prom.c | 6 ++++++
>> arch/powerpc/mm/book3s64/radix_pgtable.c | 2 ++
>> 3 files changed, 13 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/powerpc/include/asm/book3s/64/mmu.h
>> b/arch/powerpc/include/asm/book3s/64/mmu.h
>> index 55442d45c597..4245f99453f5 100644
>> --- a/arch/powerpc/include/asm/book3s/64/mmu.h
>> +++ b/arch/powerpc/include/asm/book3s/64/mmu.h
>> @@ -244,9 +244,11 @@ extern void
>> radix__setup_initial_memory_limit(phys_addr_t first_memblock_base,
>> static inline void setup_initial_memory_limit(phys_addr_t
>> first_memblock_base,
>> phys_addr_t first_memblock_size)
>> {
>> - if (early_radix_enabled())
>> - return radix__setup_initial_memory_limit(first_memblock_base,
>> - first_memblock_size);
>> + /*
>> + * Hash has more strict restrictions. At this point we don't
>> + * know which translations we will pick. Hence got with hash
>
> :s/got with/go with/
>
>> + * restrictions.
>> + */
>> return hash__setup_initial_memory_limit(first_memblock_base,
>> first_memblock_size);
>> }
>> diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
>> index d8a2fb87ba0c..340900ae95a4 100644
>> --- a/arch/powerpc/kernel/prom.c
>> +++ b/arch/powerpc/kernel/prom.c
>> @@ -811,6 +811,12 @@ void __init early_init_devtree(void *params)
>> mmu_early_init_devtree();
>> + /*
>> + * Reset ppc64_rma_size and memblock memory limit
>> + */
>> + if (early_radix_enabled())
>> + radix__setup_initial_memory_limit(memstart_addr,
>> first_memblock_size);
>> +
>> #ifdef CONFIG_PPC_POWERNV
>> /* Scan and build the list of machine check recoverable ranges */
>> of_scan_flat_dt(early_init_dt_scan_recoverable_ranges, NULL);
>> diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c
>> b/arch/powerpc/mm/book3s64/radix_pgtable.c
>> index 28c784976bed..094daf16acac 100644
>> --- a/arch/powerpc/mm/book3s64/radix_pgtable.c
>> +++ b/arch/powerpc/mm/book3s64/radix_pgtable.c
>> @@ -747,6 +747,8 @@ void radix__setup_initial_memory_limit(phys_addr_t
>> first_memblock_base,
>> * Radix mode is not limited by RMA / VRMA addressing.
>> */
>> ppc64_rma_size = ULONG_MAX;
>
>> +
>> + memblock_set_current_limit(MEMBLOCK_ALLOC_ANYWHERE);
>
> Probably the same thing but I would prefer the below instead:
>
> memblock_set_current_limit(ppc64_rma_size);
This is not really related to ppc64_rma_size right? On radix what we
actually want is memblock alloc from anywhere. Actually what we want is
memblock_set_current_limit(memblock_limit_from_rma(ppc64_rma_size))
But that is unnecessary complication?
-aneesh
^ permalink raw reply
* Re: [RFC PATCH] powerpc/drmem: use global variable instead of fetching again
From: Hari Bathini @ 2020-08-17 17:31 UTC (permalink / raw)
To: Aneesh Kumar K.V, linuxppc-dev, mpe; +Cc: Nathan Lynch
In-Reply-To: <20200806125200.252403-1-aneesh.kumar@linux.ibm.com>
On 06/08/20 6:22 pm, Aneesh Kumar K.V wrote:
> use mem_addr_cells/mem_size_cells instead of fetching the values
> again from device tree.
>
Looks good to me.
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
> ---
> arch/powerpc/mm/drmem.c | 24 ++++++------------------
> 1 file changed, 6 insertions(+), 18 deletions(-)
>
> diff --git a/arch/powerpc/mm/drmem.c b/arch/powerpc/mm/drmem.c
> index b2eeea39684c..f533a7b04ab9 100644
> --- a/arch/powerpc/mm/drmem.c
> +++ b/arch/powerpc/mm/drmem.c
> @@ -14,8 +14,6 @@
> #include <asm/prom.h>
> #include <asm/drmem.h>
>
> -static int n_root_addr_cells, n_root_size_cells;
> -
> static struct drmem_lmb_info __drmem_info;
> struct drmem_lmb_info *drmem_info = &__drmem_info;
>
> @@ -196,8 +194,8 @@ static void read_drconf_v1_cell(struct drmem_lmb *lmb,
> {
> const __be32 *p = *prop;
>
> - lmb->base_addr = of_read_number(p, n_root_addr_cells);
> - p += n_root_addr_cells;
> + lmb->base_addr = of_read_number(p, mem_addr_cells);
> + p += mem_addr_cells;
> lmb->drc_index = of_read_number(p++, 1);
>
> p++; /* skip reserved field */
> @@ -233,8 +231,8 @@ static void read_drconf_v2_cell(struct of_drconf_cell_v2 *dr_cell,
> const __be32 *p = *prop;
>
> dr_cell->seq_lmbs = of_read_number(p++, 1);
> - dr_cell->base_addr = of_read_number(p, n_root_addr_cells);
> - p += n_root_addr_cells;
> + dr_cell->base_addr = of_read_number(p, mem_addr_cells);
> + p += mem_addr_cells;
> dr_cell->drc_index = of_read_number(p++, 1);
> dr_cell->aa_index = of_read_number(p++, 1);
> dr_cell->flags = of_read_number(p++, 1);
> @@ -285,10 +283,6 @@ int __init walk_drmem_lmbs_early(unsigned long node, void *data,
> if (!prop || len < dt_root_size_cells * sizeof(__be32))
> return ret;
>
> - /* Get the address & size cells */
> - n_root_addr_cells = dt_root_addr_cells;
> - n_root_size_cells = dt_root_size_cells;
> -
> drmem_info->lmb_size = dt_mem_next_cell(dt_root_size_cells, &prop);
>
> usm = of_get_flat_dt_prop(node, "linux,drconf-usable-memory", &len);
> @@ -318,12 +312,12 @@ static int init_drmem_lmb_size(struct device_node *dn)
> return 0;
>
> prop = of_get_property(dn, "ibm,lmb-size", &len);
> - if (!prop || len < n_root_size_cells * sizeof(__be32)) {
> + if (!prop || len < mem_size_cells * sizeof(__be32)) {
> pr_info("Could not determine LMB size\n");
> return -1;
> }
>
> - drmem_info->lmb_size = of_read_number(prop, n_root_size_cells);
> + drmem_info->lmb_size = of_read_number(prop, mem_size_cells);
> return 0;
> }
>
> @@ -353,12 +347,6 @@ int walk_drmem_lmbs(struct device_node *dn, void *data,
> if (!of_root)
> return ret;
>
> - /* Get the address & size cells */
> - of_node_get(of_root);
> - n_root_addr_cells = of_n_addr_cells(of_root);
> - n_root_size_cells = of_n_size_cells(of_root);
> - of_node_put(of_root);
> -
> if (init_drmem_lmb_size(dn))
> return ret;
>
>
Thanks
Hari
^ permalink raw reply
* Re: [PATCH 0/8] scsi: convert tasklets to use new tasklet_setup()
From: Kees Cook @ 2020-08-17 19:28 UTC (permalink / raw)
To: James Bottomley
Cc: martin.petersen, linux-scsi, shivasharan.srikanteshwara,
linux-kernel, kashyap.desai, sumit.saxena, Allen Pais,
target-devel, Allen Pais, linuxppc-dev, megaraidlinux.pdl
In-Reply-To: <1597675318.4475.11.camel@linux.ibm.com>
On Mon, Aug 17, 2020 at 07:41:58AM -0700, James Bottomley wrote:
> On Mon, 2020-08-17 at 14:24 +0530, Allen Pais wrote:
> > From: Allen Pais <allen.lkml@gmail.com>
> >
> > Commit 12cc923f1ccc ("tasklet: Introduce new initialization API")'
> > introduced a new tasklet initialization API. This series converts
> > all the scsi drivers to use the new tasklet_setup() API
>
> I've got to say I agree with Jens, this was a silly obfuscation:
>
> +#define from_tasklet(var, callback_tasklet, tasklet_fieldname) \
> + container_of(callback_tasklet, typeof(*var), tasklet_fieldname)
>
> Just use container_of directly since we all understand what it does.
But then the lines get really long, wrapped, etc. This is what the
timer_struct conversion did too (added a container_of wrapper), so I
think it makes sense here too.
--
Kees Cook
^ permalink raw reply
* [PATCH v2] powerpc/pseries/svm: Allocate SWIOTLB buffer anywhere in memory
From: Thiago Jung Bauermann @ 2020-08-17 21:46 UTC (permalink / raw)
To: iommu
Cc: Konrad Rzeszutek Wilk, linuxppc-dev, Ram Pai, linux-kernel,
Satheesh Rajendran, Robin Murphy, Christoph Hellwig,
Thiago Jung Bauermann, Marek Szyprowski
POWER secure guests (i.e., guests which use the Protection Execution
Facility) need to use SWIOTLB to be able to do I/O with the hypervisor, but
they don't need the SWIOTLB memory to be in low addresses since the
hypervisor doesn't have any addressing limitation.
This solves a SWIOTLB initialization problem we are seeing in secure guests
with 128 GB of RAM: they are configured with 4 GB of crashkernel reserved
memory, which leaves no space for SWIOTLB in low addresses.
To do this, we use mostly the same code as swiotlb_init(), but allocate the
buffer using memblock_alloc() instead of memblock_alloc_low().
We also need to add swiotlb_set_no_iotlb_memory() in order to set the
no_iotlb_memory flag if initialization fails.
Signed-off-by: Thiago Jung Bauermann <bauerman@linux.ibm.com>
---
arch/powerpc/include/asm/svm.h | 4 ++++
arch/powerpc/mm/mem.c | 6 +++++-
arch/powerpc/platforms/pseries/svm.c | 27 +++++++++++++++++++++++++++
include/linux/swiotlb.h | 1 +
kernel/dma/swiotlb.c | 5 +++++
5 files changed, 42 insertions(+), 1 deletion(-)
Changes from v1:
- Open-code swiotlb_init() in arch-specific code, as suggested by
Christoph.
diff --git a/arch/powerpc/include/asm/svm.h b/arch/powerpc/include/asm/svm.h
index 85580b30aba4..7546402d796a 100644
--- a/arch/powerpc/include/asm/svm.h
+++ b/arch/powerpc/include/asm/svm.h
@@ -15,6 +15,8 @@ static inline bool is_secure_guest(void)
return mfmsr() & MSR_S;
}
+void __init svm_swiotlb_init(void);
+
void dtl_cache_ctor(void *addr);
#define get_dtl_cache_ctor() (is_secure_guest() ? dtl_cache_ctor : NULL)
@@ -25,6 +27,8 @@ static inline bool is_secure_guest(void)
return false;
}
+static inline void svm_swiotlb_init(void) {}
+
#define get_dtl_cache_ctor() NULL
#endif /* CONFIG_PPC_SVM */
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index c2c11eb8dcfc..0f21bcb16405 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -50,6 +50,7 @@
#include <asm/swiotlb.h>
#include <asm/rtas.h>
#include <asm/kasan.h>
+#include <asm/svm.h>
#include <mm/mmu_decl.h>
@@ -290,7 +291,10 @@ void __init mem_init(void)
* back to to-down.
*/
memblock_set_bottom_up(true);
- swiotlb_init(0);
+ if (is_secure_guest())
+ svm_swiotlb_init();
+ else
+ swiotlb_init(0);
#endif
high_memory = (void *) __va(max_low_pfn * PAGE_SIZE);
diff --git a/arch/powerpc/platforms/pseries/svm.c b/arch/powerpc/platforms/pseries/svm.c
index 40c0637203d5..d592e663a8d6 100644
--- a/arch/powerpc/platforms/pseries/svm.c
+++ b/arch/powerpc/platforms/pseries/svm.c
@@ -7,6 +7,7 @@
*/
#include <linux/mm.h>
+#include <linux/memblock.h>
#include <asm/machdep.h>
#include <asm/svm.h>
#include <asm/swiotlb.h>
@@ -34,6 +35,32 @@ static int __init init_svm(void)
}
machine_early_initcall(pseries, init_svm);
+/*
+ * Initialize SWIOTLB. Essentially the same as swiotlb_init(), except that it
+ * can allocate the buffer anywhere in memory. Since the hypervisor doesn't have
+ * any addressing limitation, we don't need to allocate it in low addresses.
+ */
+void __init svm_swiotlb_init(void)
+{
+ unsigned char *vstart;
+ unsigned long bytes, io_tlb_nslabs;
+
+ io_tlb_nslabs = (swiotlb_size_or_default() >> IO_TLB_SHIFT);
+ io_tlb_nslabs = ALIGN(io_tlb_nslabs, IO_TLB_SEGSIZE);
+
+ bytes = io_tlb_nslabs << IO_TLB_SHIFT;
+
+ vstart = memblock_alloc(PAGE_ALIGN(bytes), PAGE_SIZE);
+ if (vstart && !swiotlb_init_with_tbl(vstart, io_tlb_nslabs, false))
+ return;
+
+ if (io_tlb_start)
+ memblock_free_early(io_tlb_start,
+ PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT));
+ pr_warn("Cannot allocate SWIOTLB buffer");
+ swiotlb_set_no_iotlb_memory(true);
+}
+
int set_memory_encrypted(unsigned long addr, int numpages)
{
if (!PAGE_ALIGNED(addr))
diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h
index 046bb94bd4d6..991e9f13e663 100644
--- a/include/linux/swiotlb.h
+++ b/include/linux/swiotlb.h
@@ -35,6 +35,7 @@ extern unsigned long swiotlb_nr_tbl(void);
unsigned long swiotlb_size_or_default(void);
extern int swiotlb_late_init_with_tbl(char *tlb, unsigned long nslabs);
extern void __init swiotlb_update_mem_attributes(void);
+void __init swiotlb_set_no_iotlb_memory(bool value);
/*
* Enumeration for sync targets
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index c19379fabd20..ed2b8818ff67 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -132,6 +132,11 @@ early_param("swiotlb", setup_io_tlb_npages);
static bool no_iotlb_memory;
+void __init swiotlb_set_no_iotlb_memory(bool value)
+{
+ no_iotlb_memory = value;
+}
+
unsigned long swiotlb_nr_tbl(void)
{
return unlikely(no_iotlb_memory) ? 0 : io_tlb_nslabs;
^ permalink raw reply related
* Re: [PATCH] swiotlb: Allow allocating buffer anywhere in memory
From: Thiago Jung Bauermann @ 2020-08-17 21:48 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Konrad Rzeszutek Wilk, linuxppc-dev, Ram Pai, linux-kernel, iommu,
Satheesh Rajendran, Robin Murphy, Mike Rapoport, Marek Szyprowski
In-Reply-To: <20200817102020.GD25336@lst.de>
Hello Christoph,
Christoph Hellwig <hch@lst.de> writes:
> On Sat, Aug 15, 2020 at 05:45:36PM -0300, Thiago Jung Bauermann wrote:
>> POWER secure guests (i.e., guests which use the Protection Execution
>> Facility) need to use SWIOTLB to be able to do I/O with the hypervisor, but
>> they don't need the SWIOTLB memory to be in low addresses since the
>> hypervisor doesn't have any addressing limitation.
>>
>> This solves a SWIOTLB initialization problem we are seeing in secure guests
>> with 128 GB of RAM: they are configured with 4 GB of crashkernel reserved
>> memory, which leaves no space for SWIOTLB in low addresses.
>
> What about just open coding the allocation and using
> swiotlb_init_with_tbl?
Yes, that works too. I just sent a v2 implementing that change. I just
had to add a small accessor function so that I could set no_iotlb_memory
from outside swiotlb.c.
Thank you for the quick review.
--
Thiago Jung Bauermann
IBM Linux Technology Center
^ permalink raw reply
* Re: [PATCH v4 6/8] mm: Move vmap_range from lib/ioremap.c to mm/vmalloc.c
From: Tang Yizhou @ 2020-08-17 13:23 UTC (permalink / raw)
To: Nicholas Piggin, linux-mm
Cc: linux-arch, Zefan Li, Will Deacon, Catalin Marinas, x86,
linux-kernel, john.wanghui, Ingo Molnar, Borislav Petkov,
Jonathan Cameron, H. Peter Anvin, Thomas Gleixner, linuxppc-dev,
linux-arm-kernel
In-Reply-To: <20200816090904.83947-7-npiggin@gmail.com>
Hi Nicholas,
We may change the title as follows:
mm: Move vmap_range from mm/ioremap.c to mm/vmalloc.c
Yizhou
^ permalink raw reply
* Re: [PATCH 0/8] scsi: convert tasklets to use new tasklet_setup()
From: James Bottomley @ 2020-08-17 14:41 UTC (permalink / raw)
To: Allen Pais, martin.petersen, kashyap.desai, sumit.saxena,
shivasharan.srikanteshwara
Cc: keescook, linux-scsi, linux-kernel, Allen Pais, target-devel,
linuxppc-dev, megaraidlinux.pdl
In-Reply-To: <20200817085409.25268-1-allen.cryptic@gmail.com>
On Mon, 2020-08-17 at 14:24 +0530, Allen Pais wrote:
> From: Allen Pais <allen.lkml@gmail.com>
>
> Commit 12cc923f1ccc ("tasklet: Introduce new initialization API")'
> introduced a new tasklet initialization API. This series converts
> all the scsi drivers to use the new tasklet_setup() API
I've got to say I agree with Jens, this was a silly obfuscation:
+#define from_tasklet(var, callback_tasklet, tasklet_fieldname) \
+ container_of(callback_tasklet, typeof(*var), tasklet_fieldname)
Just use container_of directly since we all understand what it does.
James
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox